On Monday, 24 February 2025 at 16:07:07 UTC, Ian wrote:
Hello,

What's the recommended D way to declare a string constant? Say, for example, for a path used inside a class constructor? I've seen const string, immutable, enum etc...

Is this the place for these kinds of questions? Is there a D stack overflow?

Cheers,
 Ian

I got in the habit of using `static immutable` whenever possible as enum just can't be trusted to use CTFE.

```d
enum string RfuncName = fullyQualifiedName!...
enum string funcName = RfuncName.crc32Of.toHexString(); // Oops! Allocates on runtime every frame this is referenced
```

Reply via email to