More Intuitive Syntax for Manifest (enum) Constants

Peter C peterc at gmail.com
Tue Nov 25 09:56:48 UTC 2025


On Tuesday, 25 November 2025 at 01:58:54 UTC, Kapendev wrote:
>
> Not sure, but if you really care then just add a type to the 
> enum.
>

In D, I wasn't aware you could do that for 'a single' manifest 
constant:

enum N = 42; // this is how I've seen it used (in the opening 
post).

I had just assumed that form doesn't support a type annotation.

enum double A = 0.2; // turns out, you CAN actually type it. Nice!

so I'm a little less troubled by it now ;-)


>> standard
>> robust
>> safe
>> recommended solution
>
> Source?????

me! from experience.


More information about the Digitalmars-d mailing list