Voldemort types

From D Wiki
Revision as of 18:03, 14 December 2012 by Quickfur (talk | contribs) (stub)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In D, a Voldemort type is a type that cannot be named outside of the scope it's declared in, but code outside the scope can still use this type by taking advantage of D's static type inference.

For example:

// Note: the return type is auto, because we cannot actually name it outside the function!
auto createVoldemortType()
{
    struct TheUnnameable
    {
        int nameableMember;
    }
    return TheUnnameable(123);
}