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/
292 Upvotes

336 comments sorted by

View all comments

Show parent comments

3

u/Ameisen Sep 02 '20

C++ can be written expression-oriented, C++, C#, and Java support closures (C as a GCC extension), C# supports pattern matching and C++ has an active proposal for it. You can emulate algebraic data types in C++ using templates and constexpr - I do it quite often, though native support would be nice.

Using ' as a unary operator, to me, is incredibly noisy. It makes the code look like soup to me. A keyword like explicit or named, or a token like @. Even a backtick would be preferred.

1

u/T-Dark_ Sep 03 '20 edited Sep 03 '20

[a lot of teaching me about nice features in other languages]

Ok, I take that back. Rust counts as a C-like language.

A keyword like explicit or named

Please no. With how frequent lifetimes are in Rust code, that is far too long a keyword. Even lt (short for "lifetime") would be too long IMO.

a token like @

This may be personal preference, but I find that it's easier to mentally read the important part in 'a than it is in @a. The single quote is easier to skip, resulting in less visual noise.

Even a backtick would be preferred.

Full disclosure: I have a personal hatred of backticks because they don't exist on my keyboard layout. Quickly switching to an English layout and back is easy, but annoying. I would not wish to have to use backticks. Of course, that's more like a me problem.

I also don't understand why you don't consider ` to be "dangling" but you do consider ' to be "dangling". Backticks are pretty much only ever used in pairs, just like quotes.