Compile-Time Sort in D

Stefan Koch via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Jun 8 18:56:52 PDT 2017


On Friday, 9 June 2017 at 01:34:14 UTC, Mike Parker wrote:
> On Thursday, 8 June 2017 at 19:07:50 UTC, cym13 wrote:
>
>>
>> Seeing that the one and only D example in the nim article is a 
>> broken one (using static instead of enum or static immutable 
>> for 'b') we should have started with a correct example before 
>> showing the broken one... Good to know for next time.
>
> static variables are initialized with compile-time values. They 
> don't need be immutable for that.

they need immutable if you want to use them again at compile-time.
Therefore it is a good habit to get into.


More information about the Digitalmars-d-announce mailing list