W dniu 10.05.2013 14:32, deadalnix pisze:
http://www.deadalnix.me/2013/05/10/type-safe-tagged-union-in-d-programming-language/
A trick that I used to use more and more, so I ended up creating a
generic solution and wrote an article about it.
Here's my try on this:
https://github.com/pszturmaj/json-streaming-parser/blob/master/json.d#L111
lines 111-184. It supports Self notation, so it's possible to create
recursive unions given that Self is accessible through some indirection.
TypeTag should be an enum with increasing values starting with 0. I just
noticed, opAssign is prepended with underscore, I probably forgot to
remove it after debugging:)