Hacker News new | ask | show | jobs
by tancop 7 days ago
> it elevates a technical detail to be part of the syntax of the language

For me that's definitely a bad thing. It's the reason I don't like Rust syntax, they make you write everything out even if there is no possible way to misinterpret the code. And they never do things like Zig enum variant shorthand because syntax sugar is evil. Maybe they're just diabetic.

2 comments

Rust Deref trait can do quite a bit behind the scenes. And there is (sort of) an enum shorthand, e.g. the following works. (It's more useful in match statements.)

  #[derive(Debug)]
  enum E { A, B, C }
  pub fn main() {
    use E::*;
    let x = B;
    println!("{:?}", x);
  }
Totally fair, I get that. I’m also not a hardened C dev, so maybe it would annoy me at some point. I gripe about Go’s assignment operators from time to time, but I like it on the net.

Not really Go in general, though. It’s mostly disappeared from my personal projects, in part because of their matching allergy to syntax sugar. I am incredibly tired of writing “if err != nil” blocks, and I don’t understand why there isn’t some kind of “if this function returns a non-nil error, return zero values and the error”. If only I could get something better to make a static binary. By which I mean “I like Clojure and refuse to learn SBCL because… reasons”