Newbie style question about string constants
monkyyy
crazymonkyyy at gmail.com
Mon Feb 24 17:06:51 UTC 2025
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...
enum vs value is a tradeoff of when a decision is made; not some
oo thoery
If something is known compile time and you cant even consider how
it would change, make it an enum and your have less runtime
errors, dodge some conversions, allow more free optimization
~~const and immutable can be deleted from the language~~
More information about the Digitalmars-d-learn
mailing list