Writing pattern matching macros in D.
sarn via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Mar 5 22:51:25 PST 2017
On Monday, 6 March 2017 at 02:20:02 UTC, Deech wrote:
> Hi all,
> I've been reading up on D's metaprogramming features and was
> wondering if it was possible to use them to add pattern
> matching to the language as a macro. The template mixin feature
> seems to require putting the new syntax in strings. I was
> hoping there's an alternative.
> Thanks!
> -deech
It isn't possible in the same way it is in, say, Rust. This has
come up before and Walter has strong opinions against that kind
of rewriting macro.
This is what's currently implemented:
https://dlang.org/phobos/std_variant.html#visit
More information about the Digitalmars-d-learn
mailing list