On 2017-03-06 17:27, Deech wrote:

I was thinking something on the order of Scala's pattern matching using
apply/unapply methods. http://www.artima.com/pins1ed/extractors.html.

That should be possible. Although not as a macro and not with the same nice syntax. Something like this should be possible:

1.match(
    3, e => writeln("value is 3"),
    (int e) => writeln("value is an integer"),
    () => writeln("fallback")
);

--
/Jacob Carlborg

Reply via email to