Voldemort structs no longer work?

deadalnix deadalnix at gmail.com
Sat Dec 15 13:29:13 PST 2012


On Saturday, 15 December 2012 at 21:10:19 UTC, Jonathan M Davis 
wrote:
> On Saturday, December 15, 2012 12:18:21 H. S. Teoh wrote:
>> It seems that the only clean way to do this is to use a class 
>> instead of
>> a struct, since the .init value will conveniently just be 
>> null, thereby
>> sidestepping the problem.
>
> That would incur unnecessary overhead and probably break all 
> kinds of code,
> because they're then reference types instead of value types, 
> and a _lot_ of
> code doesn't use save propperly. If structs can't do what we 
> need as Voldemort
> types, it's just better to make it so that they're not 
> Voldemort types.
> Voldemort types are a cute idea, and in principle are great, 
> but I don't think
> that it's worth fighting to keep them if they have problems.
>
> - Jonathan M Davis

I always found them inconsistent with the behavior they have in 
classes (where no outer pointer is created).

This is a lot of work to do in the standard lib however.


More information about the Digitalmars-d mailing list