4 ms·
I've used Rust and I like it alright but it has the ugliest syntax of any major language since Perl
by labrador 4y ago
I've used Rust and I like it alright but it has the ugliest syntax of any major language since Perl
- proto_lambda 4y agoHave you seen modern C++? It has had new syntax bolted on every couple years for the past few decades, the result is quite phenomenal.
- MauranKilom 4y agoCan you name what new syntax you abhor? I mean, other than []<>(){}() being a valid C++ expression [0], C++ hasn't even made any notable sygil-related syntax changes recently. Sure, some keywords were added (auto, constexpr, co_yield...) but I don't see how that leads to "ugly" syntax. [0]: That's a lambda capturing no state, having no template parameters, taking no arguments, with an empty body, finally being called immediately with no arguments. But half of that is optional. A more usual lambda would look like [foo](int bar) { return foo+bar; }.
- mkl 4y agoTechnically auto was already a keyword (from C) and was just repurposed. Pedantic but interesting. https://en.cppreference.com/w/c/keyword https://en.cppreference.com/w/c/keyword
- woodruffw 4y agoI find the new user-defined literals syntax pretty ugly. Useful, but ugly. On the older side: the initialization list syntax has always been ugly (and bug-prone, due to the unintuitive evaluation order.)
- ImprobableTruth 4y ago'requires requires' makes me cry
- kingaillas 4y agoAnything with templates, type traits, especially when nested. (The kind of spew you get on an compilation error). Even template< typename T > struct foo<T, std::void_t<decltype(++std::declval<T&>() )>> : std::true_type { }; looks terrible and that's just basic.
- masklinn 4y agoI still wish Rust had a way to express decltype tho. `impl Trait` doesn't always work, and when it doesn't it's quite frustrating.
- estebank 4y agoWhat limitation do you encounter with `impl Trait`? They might be removed by `type Alias = impl Trait;` soon. https://rust-lang.github.io/rfcs/2515-type_alias_impl_trait.html https://rust-lang.github.io/rfcs/2515-type_alias_impl_trait....
- marcosdumay 4y agoYou will notice that this is almost valid Rust. (Rust is a very small bit better, not enough to matter.) In fact, a lot of what the Rust syntax ugly was taken from C++, and it took most of what makes C++ ugly. So the entire discussion is just amusing.
- pclmulqdq 4y agoModern C++ looks horrendously ugly if you are a library writer, but on business logic it looks a lot tamer than rust.
- voidhorse 4y agoagreed, I’ve tried to pick up rust a few times and the syntax has always made me give up halfway through the point of writing a real project. It’s really a shame since they had every opportunity not to make the syntax horrible. CPP has horrendous syntax but a lot of that is because they needed to start representing features over time that didn’t exist from the ground up. Rust had pretty much all of its killer features form the start but for unknown reasons elected to use a tremendously noisy syntax that seems to be inspired by the monstrosity that is modern cpp syntax.
- kibwen 4y agoIt shouldn't be surprising that Rust's syntax is inspired by C++, Rust is literally designed to entice C++ programmers, and the syntax reflects that (modulo a handful of irresistible ML-isms to match the type system).
- ajdude 4y agoThis is my trouble with Rust. Thankfully Ada will do the same things addressed in this article while having a much more readable syntax.