Hacker News new | ask | show | jobs
by throwup 1294 days ago
So many complaints above surface-level syntax here.

> press "shift 3 bracket shift 9 shift 0 bracket" at the top of my structs

Just use an IDE and you can press alt+enter. Same thing you do in Java when writing getters and setters for your AbstractFactoryBeans.

> "let mut" could have been "var"

The "mut" does not belong to the "let", it belongs to the variable name.

  let (read_only, mut read_write) = (1, 2);
> Passing "self" as the first argument was bullshit

Explicit is better than implicit. I quite like the names in the argument list to match the set of names available in the function, rather than having an extra keyword (`static`) that you add to remove a function parameter.

1 comments

> Explicit is better than implicit.

Not only that, but in Rust it actually has a meaning. Self can be &self or &mut self, which impacts the calling conventions.

The alternative would be fully typing anything but owned method calls which would just not have a self parameter, which would be incredibly weird.

It also shows that as in Python (and really even more so) "methods" are little more than syntactic sugar for functions. It would also require a new and separate syntax to declare non-instance methods.

It can also be `self: Box<Self>` or `mut self: Pin<&mut Self>` or `self: Box<Arc<Rc<Self>>>` if you feel brave.