Sat, 26 Sep 2009 18:28:52 +0200, Lutger thusly wrote:

> a hash literal works like this, index with the typeid to get a function
> ptr you can call:
> 
> Algebraic!(int, Foo) a;
> a = 3;
> [ typeid(int) : function { writeln("a is int"); },
>   typeid(Foo) : function { writeln("a is Foo"); }
> ] [a.type] ();

A visitor approach might have a bit slower coefficient than the hash, but 
the same time complexity.

Reply via email to