logoalt Hacker News

wtetznerlast Tuesday at 6:23 PM4 repliesview on HN

Ugly is subjective, but which part of the syntax is inconsistent?


Replies

j-kriegerlast Tuesday at 10:30 PM

I tended to disagree on this discussion in the past, but I increasingly no longer do. For example, let's have a look at the new `implicit lifetime capturing` syntax:

  fn f(x: &()) -> impl Sized + use<'_> { x }
It's weird. It's full of sigils. It's not what the Rust team envisioned before a few key members left.
show 1 reply
dlisboalast Tuesday at 7:16 PM

I don't know if this qualifies as inconsistent, but:

`impl T for for<'a> fn(&'a u8) {}`

The `for` word here is used in two different meanings, both different from each other and from the third and more usual `for` loop.

Rust just has very weird syntax decisions. All understandable in isolation but when put altogether it does yield a hard to read language.

show 2 replies
arccylast Tuesday at 6:28 PM

.await something that looks like a field access but actually does something else

show 1 reply
xigoilast Thursday at 8:06 AM

Just some examples I thought of:

* Array types have completely different syntax from other generic types

* &mut T has a space between the qualifier and the type, &T doesn’t

* The syntax for anonymous functions is completely different from a function declaration