spir napisał: > In Lisp-like languages, a list can hold anything: > (1 "a" (1 "a")) > I do not find it trivial to simulate this in D. Using a linked list or an > array: the issue is not with the kind of > collection but with elements. In either case, I guess, elements should > actually be void* pointers. But then, the type > is lost; to properly get back stored values, it seems one would have to add > tagged-union-like tagging --but for > pointers. > > How would you do that? Various proposals welcome :-)
std.variant is the discriminated union type in Phobos. Conversion back to original type is not implicit, though. -- Tomek