DMD 1.017 release

Chris Nicholson-Sauls ibisbasenji at gmail.com
Tue Jun 26 13:55:45 PDT 2007


Walter Bright wrote:
> Stewart Gordon wrote:
>> "Walter Bright" <newshound1 at digitalmars.com> wrote in message 
>> news:f5rmna$3101$1 at digitalmars.com...
>>> A corresponding 2.001 should be out soon.
>>>
>>> http://www.digitalmars.com/d/1.0/changelog.html
>>
>> "The .init property for a variable is now based on its type, not its 
>> initializer."
>>
>> Why?
> 
> Suppose:
> 
>     int f = random();
> 
> in other words, let's say the initializer was a runtime computation that 
> changes every time it is computed. This causes problems because then:
> 
>     assert(f == f.init)
> 
> fails.
> 

Valid logic, but what about the common case of 'int f = 42;'?  Maybe the 
rule should be that .init is either a /literal/ initializer's value, or 
a CTF initializer's value, or else the type's .init value.  (I can 
recall having once or twice relied on a variable's .init being something 
particular.)

-- Chris Nicholson-Sauls



More information about the Digitalmars-d-announce mailing list