5 ms·
The explosion of single character sigils and the taint of C++'s template syntax.
by akira2501 2y ago
The explosion of single character sigils and the taint of C++'s template syntax.
- Vecr 2y agoWhat's mandated to be a single character? I'm not sure what the popular style is today.
- maxk42 2y agoThe only single-character sigils I can think of are '&', '*', '\'', and maybe '?'. Am I missing any?
- recursivecaveat 2y agoThe ' for lifetimes as well.
- maxk42 2y agoThat was the third example I gave.
- deleted 2y ago[deleted]
- troupo 2y agoIt's probably the explosion of those characters and punctuation characters like in this example: https://x.com/AndersonAndrue/status/1864457598629540348 https://x.com/AndersonAndrue/status/1864457598629540348 To quote Tsoding, https://x.com/tsoding/status/1832631084888080750 https://x.com/tsoding/status/1832631084888080750: "Rust is a very safe, unergonomic language with annoying community and atrocious syntax. Which is somehow surprisingly miles better than modern C++."
- swiftcoder 2y agoAnderson's example has literally one more sigil than the equivalent C++
- saghm 2y ago> It's probably the explosion of those characters and punctuation characters like in this example: https://x.com/AndersonAndrue/status/1864457598629540348 https://x.com/AndersonAndrue/status/1864457598629540348 I feel like there's plenty of places to make criticisms of Rust's syntax, but the example they picked has like half a dozen places where the full path to reference an item is used instead of importing it. Sure, there are languages where you're required to import things rather than referencing them in the full path, but there are also languages where you don't have any flexibility in the paths to use something (e.g. Go and Java) or where they dump literally everything into a single namespace with no context (e.g. C and C++). Using the entire path to something instead of importing it is absurdly less common by at least an order of magnitude over importing things directly, so it's not like people are abusing it all over the place (if anything, people probably import things _more_ than they need to, like with top-level functions that might otherwise make their provenance obvious). Having an option to do things verbosely that most people don't actually do is "unergonomic"? It's like saying the problem with Unix file paths is that using absolute paths for literally everything is ugly; sure, it can be, but that's also just not how 99% of people use them.
- FridgeSeal 2y agoWhy is old mate artificially constructing the most non-representative example possible? Full import paths for map and iter? I’ve never seen anyone double-underscore stuff in Rust. Outside of specific stdlib cases, I haven’t seen anyone manually need to (or do) specify iterator adaptors like that. They could have at least chosen a representative example. This just comes across as fabricating something to get angry at.
- School-Cotton 2y agoThe first example doesn’t show anything particularly wrong with Rust syntax. You can construct a troll example like this of an arbitrarily complex type in any language with generics. The second tweet, as is common for these discussions, doesn’t give any specific example of what’s wrong with Rust syntax. I remain baffled by how many people hate Rust syntax. I really don’t get it!
- dgfitz 2y agoI really want to get it, I just don’t quite, at least not yet.
- akira2501 2y agoI kinda feel like macros!() should count.
- littlestymaar 2y ago> and the taint of C++'s template syntax. Interestingly enough, nobody says that when talking about TypeScript…
- galangalalgol 2y agoWhat languages have better template syntax?
- kelnos 2y agoUsing that (or similar, e.g. with [] instead of <>) syntax for generics is common across many languages, not just Rust or C++. You may find it ugly, but there's plenty of precedent. What do you think would be better?