Voldemort Types in D

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri May 11 11:07:36 PDT 2012


On 5/9/12, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> http://www.reddit.com/r/programming/comments/telhj/voldemort_types_in_d/

"Sorry, that won't work, the compiler will not allow a Voldemort Type
to be instantiated outside of its scope (the technical reason is it
has no reference to the seed local variable)."

Actually you can, although this should probably be disallowed:

import std.traits;
alias ReturnType!(generator) Gen;
Gen gen;

void main()
{
    writeln(gen.front);  // access violation
}


More information about the Digitalmars-d-announce mailing list