Type unions in D

Justin Johansson procode at adam-dott-com.au
Tue Sep 15 17:40:02 PDT 2009


Jeremie Pelletier Wrote:

> Justin Johansson Wrote:
> 
> > What's the best way of emulating a system of quantified type unions in D  (D1)?

> What you want sounds a lot like a variant type. Check std.variant in phobos, it has a template to let you define custom variants through type tuples.

Thanks Jeremie.  It certainly does .. but the reason I haven't seen it before is because I'm using D1.  Sure enough though I poked the D2 Phobos code and there it was.  Right at the top of the file is the link to Andrei's circa 2002 article in DDJ which makes for very interesting reading.

http://erdani.org/publications/cuj-04-2002.html

A colleague of mine is suggesting that I really do take a closer look at D2 now but I'm not sure that I'm ready to go standing on the bleading bleading (the blood doesn't clot) edge just right yet. :-(

JJ




More information about the Digitalmars-d mailing list