DMD 1.017 release

Stewart Gordon smjg_1998 at yahoo.com
Tue Jun 26 16:23:25 PDT 2007


"Walter Bright" <newshound1 at digitalmars.com> wrote in message 
news:f5s1k1$iuk$1 at digitalmars.com...
> Chris Nicholson-Sauls wrote:
>> 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.)
>
> How about, if it isn't a compile time constant, then using .init is an 
> error?

Good idea.  It would also enable

    is(typeof(x.init))

to be used to test whether x's initializer is a compile-time constant. 
Don't know what practical use this would have though....

> I think that if CTFE fails, having it silently revert to the type.init, 
> would be frustratingly obscure behavior.

Agreed.  Moreover, if they want the initializer of x's type, they can use 
typeof(x).init.  So changing x.init to do the same not only alters the 
behaviour of existing code, but gains no real benefit in the process.

Stewart. 




More information about the Digitalmars-d-announce mailing list