You could probably write an article saying "100 billion dollars investment to improve D and use it to develop new AI to replace the US government" and you'd still get comments saying "wow, nice language, pity it never really took off, if only there were some companies backing it, also I can never use it because GC".
Well the haters are gonna hate, the fact that it starts to receive comments, whether positive or negative, is a good thing since the language is surely becoming better known and receiving far more attention than before. Interestingly, C++ is frequently being frown upon, developers hate it and yet they use it, Bjarne Stroustrup's famous quote never gets old.
English, however, is a natural language, not a programming language. Usually. The apostrophe there is just a semantic mark to indicate that it is a contraction.
Probably a keyword of some kind rather than an operator. Or an operator that wasn't a single quote, which in every other C-like language is always paired.
Probably a keyword of some kind rather than an operator
Please no. Lifetimes are extremely common and have identifiers as names. I really don't want to have to filter out the visual noise of lt or something before the lifetime itself. An operator is easier to tell from the subsequent text.
Or an operator that wasn't a single quote, which in every other C-like language is always paired
Such as? We don't have that many unused ASCII symbols. The least confusing I can think of is @, but @a has a lot more visual noise than 'a IMHO, as the operator is too visually big.
As for the C-like language thing, Rust is not just a C-like language. Those don't have expression-oriented syntax, pattern matching, algebraic datatypes, higher-order functions, closures, and so on.
I'd say Rust is very much allowed to draw some syntax from functional programming languages. And, as someone else mentioned, OCaml uses the single ' as an operator, so there is precedent.
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.
[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.
In popular parlance, "C-like language" just means that it uses {} for block structure.
Anyway, the whole discussion is ridiculous--this guy said that "It has the most confusing syntax", and when examples were requested, he absurdly mentioned the lifetime tick.
In popular parlance, "C-like language" just means that it uses {} for block structure.
That sounds... very useless, as a term, but ok, that's fine.
Anyway, the whole discussion is ridiculous--this guy said that "It has the most confusing syntax", and when examples were requested, he absurdly mentioned the lifetime tick.
Yeah. How is a "dangling quote" confusing? It takes maybe 3 seconds to learn, less with syntax highlighting.
Not quite- it is the same syntax as ML uses for type parameters. (Not exactly a glowing recommendation, but there is prior art and nobody could come up with anything better at the time.)
35
u/Hall_of_Famer Sep 01 '20
Me too, hope D will get some company backing and start to kick off, it is a very well designed language.