Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This seems to be a fairly common sentiment. I consider Rust's syntax fairly consistent and elegant for a curly brace language, but evidently I have some blind spots. What quibbles do you have with Rust's syntax?


The explosion of single character sigils and the taint of C++'s template syntax.


> and the taint of C++'s template syntax.

Interestingly enough, nobody says that when talking about TypeScript…


What languages have better template syntax?


Using 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?


The only single-character sigils I can think of are '&', '*', '\'', and maybe '?'. Am I missing any?


The ' for lifetimes as well.


That was the third example I gave.


I kinda feel like macros!() should count.


It's probably the explosion of those characters and punctuation characters like in this example: https://x.com/AndersonAndrue/status/1864457598629540348

To quote Tsoding, 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++."


> It's probably the explosion of those characters and punctuation characters like in this example: 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.


The 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!


I really want to get it, I just don’t quite, at least not yet.


Why 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.


Anderson's example has literally one more sigil than the equivalent C++


What's mandated to be a single character? I'm not sure what the popular style is today.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: