3 ms·
A recent observation about the advantage of syntactic minimalism: As a newcomer to Rust, a thing I noticed is the syntactic explicitness around generics: In pa
by sshine 4y ago
A recent observation about the advantage of syntactic minimalism:
As a newcomer to Rust, a thing I noticed is the syntactic explicitness around generics: In particular, I had to learn to write Foo::<T>::bar(), i.e. the double `::` seems verbose. But it is also unambiguous that the `<` is not a less-than, because it comes to the right of a `::`. There are other `<T>`s that don't need `::` because they're already somewhere that could only be a type. A human probably wouldn't mistake those. So you might have syntactic complexity in a syntax that is easy for a human to wrap their minds around, and perhaps even makes expressing yourself easier.
It wasn't until recently that someone on ##rust pointed out that with unambiguous syntax, you can more easily transform old code, too. So in some future where a piece of syntax changes, you can more easily write a tool that transforms old code into new code.
- thrtythreeforty 4y agoThe turbofish gets everyone's goat at some point but it teaches an important lesson: it is incredibly difficult to build a Rust-size grammar that is free of ambiguities! Modern parser tooling (e.g. tree-sitter) will at least yell at you when you specify an ambiguity.