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/mhdcpnnydgspxllis...@forum.dlang.org
http://forum.dlang.org/post/znfrdjkpxtixiydxp...@forum.dlang.org
http://forum.dlang.org/post/ugiypegvtdhhvzrmf...@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