A switch/case too far...
BCS
ao at pathlink.com
Tue May 20 15:06:02 PDT 2008
Reply to Gregor,
> DISCLAIMER: This suggestion is not serious. Oh please dear god no.
>
> This would be simple if you could switch on a single-value function
> returning bool, and if there was some form of sections ala Haskell,
> e.g.:
>
> switch (a is) {
> case b:
> (etc)
> }
>
> - Gregor Richards
>
I think you might be able to implement that using recursive templates (like
I demonstrated in my D '07 talk)
it would look something like this
Switch!(Object, bool function(Object a, Object b){return a is b;}, A).
Case!(B, {action();}).
Case!(C, {something();}).
End();
OTOH I think you get an issue with not being able to alias local stuff.
p.s. No I'm not serious either.
More information about the Digitalmars-d
mailing list