Hacker News new | ask | show | jobs
by simon_o 3207 days ago
> I just think that using the semicolon to make the function return unit instead is problematic.

Agree. The idea to attach additional semantics to ; is completely nuts, especially as ; is mandatory in Rust (usually, there are odd corner cases where it is not allowed).

Just get rid of mandatory ; completely and let the type system handle the rest.

1 comments

; is used to separate statements, how do you propose to get rid of that?

I guess you could use significant newlines like python but I never really liked that. I think Rust's compromise is pretty decent.

In particular it's the first time I hear people complaining about it, so far most users (myself included) seem to be praising it. Javascript's handling of semicolon is nuts, I wouldn't say Rust's is.

It's 2017, I'm not placing ; by hand anymore.

We have computers they are perfectly able infer them for me.

> Javascript's handling of semicolon is nuts, I wouldn't say Rust's is.

- JavaScript does insane things, as usual. This doesn't mean every implementation of semicolon inference has to be that bad and broken.

- Rust goes the other way by pretending it's still 1990.

There are plenty of languages out there that handle semicolon inference perfectly fine.

(Heck, I even let the IDE show me where the compiler has placed them.)