On Sunday, 27 April 2014 at 20:54:02 UTC, bearophile wrote:
An Algebraic is a sum type, so you can't store two value in it, only one, an int or a T*. But this is not going to solve your problems...

Bye,
bearophile

Ah, you're right. I'm getting mixed up from my own initial example. Fiddling with it a bit brings me back around to your code:

import std.variant;

alias List = Algebraic!(int, This[]);

void main()
{
        List l = List([List(1), List([List(2)])]);
}

Which is absolutely ugly. The more I try to use Algebraic, the more I come to think that this is something that can't be done cleanly in a library, even in D.

Reply via email to