Pattern matching in D?
Dennis Ritchie via Digitalmars-d
digitalmars-d at puremagic.com
Thu Oct 20 23:50:26 PDT 2016
On Friday, 21 October 2016 at 02:16:44 UTC, Chris M. wrote:
> So I know you can do some pattern matching with templates in D,
> but has there been any discussion about implementing it as a
> language feature, maybe something similar to Rust's match
> keyword (https://doc.rust-lang.org/stable/book/patterns.html)?
> What would your guys' thoughts be?
On this topic there were many discussions. Here are some of them:
http://forum.dlang.org/post/mhdcpnnydgspxllismlb@forum.dlang.org
http://forum.dlang.org/post/znfrdjkpxtixiydxpcbr@forum.dlang.org
http://forum.dlang.org/post/ugiypegvtdhhvzrmfuua@forum.dlang.org
The problem is that D is not macros, and the implementation of
pattern matching without macros will not be very good. In turn,
the implementation of macros in D - this is also not a good idea.
Previously, there were ideas on the implementation of macros in
D, but now they are no longer relevant:
http://s3.amazonaws.com/dconf2007/WalterAndrei.pdf
More information about the Digitalmars-d
mailing list