Andrei Alexandrescu <[email protected]> wrote:
> Hi Shin,
> 
> 
> This is solid work! There's an opportunity here - it overlaps a LOT with 
> std.variant.Algebraic.
> 
> Essentially it would be best if you integrated opDispatch, 
> _onActiveDuck, and friends inside Algebraic. Then Algebraic would become 
> meta-duck - it still supports any combination of types, but you can call 
> any method they share against the Algebraic.
> 
> What do you think?
> 
> 
> Andrei

I too think that these features should be in Algebraic.

Actually, I created Any because Algebraic did not support dispatching
and copy constructing.  I did not touch Algebraic because it was
rather difficult to implement opDispatch to the backing VariantN.

Then, may I integrate Any into Algebraic?  The interface will be
changed:

Algebraic!(short, int) x;
x.allowed!int   -->     x.Algebraic.allowed!int
x.hasValue      -->     x.Algebraic.empty
x.peek!int      -->     &(x.Algebraic.instance!int())


> P.S. I *love* the trick with the homonym inner namespace! It solves the 
> naming problem so elegantly. I'll use it in RefCounted too.

It was a bit surprising for me that the inner template could access
member variables without being mixed in.  But I found that it's just
another "template member function", and so it's legal. :-)


Shin
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to