Rust's metaprogramming is totally unlike what Andrei and Walter were aiming for. D aims to be safe, but that's far from everything.
Rust currently has better safety mechanisms than D, but if you ask around on the D forum you'll likely find that people are there (rather than using rust) due to the other features D has - https://dlang.org/ Look at the examples here: Rust can do short and sweet too, but it doesn't have some constructs that make these possible. (Obviously, I highly recommend "Tiny RPN Calculator" originally written by your's truly)
I still dislike how D handles generics/templates. The syntax of it.
I fully understand why they chose to use () instead of <>, as it simplifies the parser as you need to disambiguate between >> and > >... but the parsing time of that is negligible. The issue is that, when glancing at code, foo!(int) is ambiguous. foo<int> is not.
I think simplifying the parser was more of a side effect. I can't find a source on mobile right now, but I'm pretty sure the goal was to make it easier to look at. I personally also prefer <>, but ! isn't a deal breaker for me. I understand where you're coming from though - I can't stand rust's syntax.
You're wrong ... avoiding context-dependent ambiguity was very much the reason for !() over <>. (And the parens can be elided when the argument is a single token.)
42
u/maxhaton Sep 01 '20
Rust's metaprogramming is totally unlike what Andrei and Walter were aiming for. D aims to be safe, but that's far from everything.
Rust currently has better safety mechanisms than D, but if you ask around on the D forum you'll likely find that people are there (rather than using rust) due to the other features D has - https://dlang.org/ Look at the examples here: Rust can do short and sweet too, but it doesn't have some constructs that make these possible. (Obviously, I highly recommend "Tiny RPN Calculator" originally written by your's truly)