Logical const

Walter Bright newshound2 at digitalmars.com
Mon Nov 29 18:00:10 PST 2010


Simen kjaeraas wrote:
> Walter Bright <newshound2 at digitalmars.com> wrote:
> 
>> Simen kjaeraas wrote:
>>> I am not convinced that such an extension of the type system should be
>>> made, but I believe you are wrong in that it is not verifiable. but
>>> please, do show me my mistake.
>>
>> It is not verifiable because nothing prevents you from assigning:
>>
>>     m = random();
>>
>> That is not logical const.
> 
> Pardon my stubbornness (and perhaps ignorance), but how is this any less
> logical const than is 'm = 4;' or 'm = n * 3 + cast(int)phaseOfMoon();'?


Logical const means the same value is returned every time, not a different one.


More information about the Digitalmars-d mailing list