July 02, 2009
BCS wrote:
> Hello Ary,
> 
>> Well, it should work! const means, once a value is assigned to that
>> variable, it never changes again. The compiler can do static analysis
>> to verify this. And that's why it works. And that's why D should also
>> work this way, IMHO.
>>
> 
> In D1, const is truly const, as in never changes, ever, not even from one run of the program to another. D2 keeps this idea but IIRC calls it something else.
> 
> 

In D2 you use enum for that, I think. The contents of const and invariant variables can both be set at run time, whereas enums must be known at compile time.

-Lars
July 02, 2009
On Thu, Jul 2, 2009 at 9:07 AM, BCS<none@anon.com> wrote:
> Hello Ary,
>
>> Well, it should work! const means, once a value is assigned to that variable, it never changes again. The compiler can do static analysis to verify this. And that's why it works. And that's why D should also work this way, IMHO.
>>
>
> In D1, const is truly const, as in never changes, ever, not even from one run of the program to another. D2 keeps this idea but IIRC calls it something else.

That's what D2 uses "enum" for.

--bb
1 2
Next ›   Last »