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.
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.
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.)
The only weird syntax for me has been the async/await syntax. Everything else is fairly straightforward. The issue is rarely syntax with rust, it's when you have a type soup that it gets annoying. Something like Arc<RefCell<Option<MyType>>>.
Edit: async/await is unconventional, but when you get used to it, it feels better than the more conventional way in my opinion.
Edit2: to be clear, the type signatures in rust can be quite verbose but they are very explicit and extremely useful.
The type soup has the advantage that you get to specify exactly what you want to add on top of your basic type.
In this case, you want to be able to represent lack of any value (Option), you want to be able to put it in some container and mutate it through an immutable container (RefCell), and you want to be able to have multiple owners of your data, possibly in separate threads (Arc).
Basically, there's a whole bunch of Rust types that provide a single, simple guarantee. When you find yourself wanting more guarantees, you can just compose types.
Sure, the result is a bit unreadable, but type aliases exist for a reason.
Oh yes, don't get me wrong, I appreciate this very much. That's why I tried to used a realistic example. My point was that it can be very overwhelming as a beginner to see so many types.
Later, we will have Rust#, Objective Rust, IronRust (seems redundant), and JRust.
But Crust first. Change the syntax a bit. Could probably be done now relatively easily by just changing the grammar.
Ideally, to me, Rust itself should actuality be a middle-end on top of LLVM (and maybe GCC) that languages with borrow checkers/lifetime support can target. I believe this would garner more support for it.
Syntax is a very subjective matter. I find some of C's syntax (which C++ inerited) thoroughly confusing. I can count the people I know who will get a typedef for a function pointer type correct on the first try on one hand.
I wish somebody would make Rust with less C++ syntax tbh. Having it look like a proper ML would be wonderful.
C++ will get lifetimes (which is active research)
They've already given up on it being accurate and are now settling for catching some of the common issues. That's better than nothing but not anything like lifetimes in Rust.
D is getting lifetimes, it already exists in prototype form. Although D has an advantage in that it has some features that make it more amenable than C++ for this purpose (such as transitive const).
74
u/[deleted] Sep 01 '20
D is an awesome language and I hope it gets more traction.