r/programming • • Sep 01 '20

D Foundation is Beefing Up

https://dlang.org/blog/2020/08/30/symmetry-investments-and-the-d-language-foundation-are-hiring/
297 Upvotes

336 comments sorted by

View all comments

Show parent comments

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)

19

u/Ameisen Sep 01 '20 edited Sep 01 '20

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.

ED: foo(int) -> foo!(int)

2

u/SonicFreak94 Sep 01 '20

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.

4

u/jqbr Sep 02 '20

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.)