Voldemort types
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.
Usage
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);
}
Here is how the Voldemort type can be used:
auto voldemort = createVoldemortType();
writeln(voldemort.nameableMember); // prints 123
The type of the variable voldemort cannot be explicitly named here, because that name is only accessible inside the function createVoldemortType. However, we can still declare variables of that type by using D's static type inference.
Purpose
This section is a stub. Please help the wiki by adding more content here.
Voldemort types are widely used in Phobos's range-based functions.