Feature Request: make void a value type
Jarrett Billingsley
kb3ctd2 at yahoo.com
Mon Dec 3 13:36:58 PST 2007
"downs" <default_357-line at yahoo.de> wrote in message
news:fj1j9d$1elr$1 at digitalmars.com...
> Christopher Wright wrote:
>> I did have completely separate ways of proxying void methods versus
>> returning methods, and it was a mess. Ugliness to the core. Right now,
>> I'm replacing it with static ifs, which is bulky and ugly, but it avoids
>> rampant code duplication.
>>
>> Your suggestion would simplify my code even more. I could eliminate
>> almost all the static ifs, as long as void.init worked.
>
> .init is broken in interesting ways for several cases (ever tried
> typeof((int[4]).init)?)
> Try template Init(T) { T Init; } instead. :)
> --downs
That's not actually broken -- the init of a fixed array is the init of its
element types. std.traits actually uses this bizarre inconsistency to
determine isStaticArray.
More information about the Digitalmars-d
mailing list