Componentizing D's garbage collector
deadalnix
deadalnix at gmail.com
Tue Jan 14 12:47:48 PST 2014
On Tuesday, 14 January 2014 at 19:09:00 UTC, Tofu Ninja wrote:
> Why are unions with pointers even allowed in the first place?
> It seems like a really really really bad thing to do. Am I
> missing some really important use case?
Tagged unions are very useful. For instance, to take a
simplified, but real life example, I have a function to resolve
identifier in a compiler. It can resolve as a type, as an
expression, as a template, as a package or module, or whatnot.
This is a case where you need to return an union of types (or
rely on complete type erasure).
More information about the Digitalmars-d
mailing list