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

    struct Foo<T> {
       t: T
        }
Braces... one extra sign (and line) for nothing while indentation works fine.

    import foo::bar::baz;
    import foo.bar.baz
4 times the dots, also useless comma.

Objectively less visual noise in Python. Of course the importance of it is subjective, I agree with that. But still, less cruft is good.

> minor things that barely barely impact readability

Of course, I don't agree :-)



These are subjective things. I don't consider Rust syntax perfect, but I don't these suggestions as way to improve it substationally.

If you want to get rid of `::` and `;` and braces you have to look at the fallout of those decisions.

Braces are imo much better at being robust than whitespace.

    def Foo[T]:
      t: T
      size: u32 // invisible error here because someone used tabs by mistake

`;` disambiguate expression vs statement. If you remove it you need way to differentiate between them.

Another problem with `import foo.bar.baz` is how will you distinguish between a method call or a type declaration? E.g. `std.option.Option.Some` what is this? Type? Method? Module? What is `std::f64::consts`???

Not to mention you kinda have to have compiler in mind, if syntax is ambigous you're going to have a very bad time.


I agree with that and would not want to see braces and semicolons go because they are pretty conventional. In this case Python and Javascript/Typescript are the outliers.

It's the opposite for the double colon syntax which, apart from Rust, to the best of my knowledge only exists in C++ (for good reasons) and some functional languages for a completely different purpose.

Honestly curious question: What fallout would you see from replacing it with a dot in Rust. I immediately see no disambiguation issues, but I'm not a compiler writer.


> // invisible error here because someone used tabs by mistake

would not parse, so no invisible mistake.


Implying every site you post code to will have correct syntax highlighter.


Rust's philosophy is "explicit over implicit" - braces fall inline with that. One extra line for a struct is really not a lot.

That whitespace sensitivity also leads to having to escape newlines, with `\` trailing lines all over the place in Python. I find that far uglier than "4 times the dots" for import statements.

> Of course, I don't agree :-)

For sure, I think that's kind of my point. Like, this all feels very unimportant to me and extremely subjective. I think that rust's syntax fits into its philosophy, however. I would not mind unifying path syntax such that `:` became `.` however.


oh the irony...

    "Explicit is better than implicit."
;-)


It's a fantastic example of how witty sayings don't necessarily lead to agreement, even among people who would agree in the truth of the saying.


Indeed... "philosophy" is often a poor justification for technical choices.


I don't actually see the irony?




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

Search: