Live data from Hacker News

Such a Little Thing: The Semicolon in Rust

lucumr.pocoo.org

21–30 of 81 posts

Re: Such a Little Thing: The Semicolon in Rust

#21
post #10

Are semicolons annoying to type? Probably, I got used to them The semicolon is the least-annoying non-letter character to type. It's right there on your home row.

Hello American. I'm from one of those other pesky countries that make up most of the human population of earth, and which usually have other keyboard layouts. I have to type shift+, to get the semicolon.

[deleted]

Re: Such a Little Thing: The Semicolon in Rust

#22
post #10

Are semicolons annoying to type? Probably, I got used to them The semicolon is the least-annoying non-letter character to type. It's right there on your home row.

Hello American. I'm from one of those other pesky countries that make up most of the human population of earth, and which usually have other keyboard layouts. I have to type shift+, to get the semicolon.

[deleted]

Re: Such a Little Thing: The Semicolon in Rust

#23
post #5

Is that really some "special behavior"? As far as i understand the semicolon is just an expression separator like in Erlang and Pascal. In contrast, the semicolon is a statement terminator in C. C uses the comma for expression separation. Practically everything is an expression in Rust, even blocks, so foo() => evaluates to the return value of foo { foo() } => evaluates to the return value of foo { foo(); } => evalua…

That's what makes it elegant: it lets you omit the return statement (safely) but otherwise looks exactly the same as C, even though it's semantically different.

Re: Such a Little Thing: The Semicolon in Rust

#24
post #13

Take a look at Haskell for a very clean and expressive syntax without (required) semicolons.

I'd rather have significant semi-colons than significant whitespace[1]. Don't mix presentation and semantics.

1: http://c2.com/cgi/wiki?SyntacticallySignificantWhitespaceCon...

Re: Such a Little Thing: The Semicolon in Rust

#25
post #10

Are semicolons annoying to type? Probably, I got used to them The semicolon is the least-annoying non-letter character to type. It's right there on your home row.

Hello American. I'm from one of those other pesky countries that make up most of the human population of earth, and which usually have other keyboard layouts. I have to type shift+, to get the semicolon.

That sounds really tough. An extra key press. I bet that wastes like, 10 seconds a day.

Re: Such a Little Thing: The Semicolon in Rust

#27
post #15

Earlier quoted context omitted.

Which keyboard layout is that?

Czech; German; Polish; French; Spanish; Italian; Portuguese; etc etc etc.

That being said, there are also programmer's layouts specific to single languages which among others have a semi-colon on the home row.

Re: Such a Little Thing: The Semicolon in Rust

#28
post #10

Are semicolons annoying to type? Probably, I got used to them The semicolon is the least-annoying non-letter character to type. It's right there on your home row.

Hello American. I'm from one of those other pesky countries that make up most of the human population of earth, and which usually have other keyboard layouts. I have to type shift+, to get the semicolon.

A potential workaround is to always use an American keyboard. It's what I do.

Re: Such a Little Thing: The Semicolon in Rust

#29
post #24
post #13

Take a look at Haskell for a very clean and expressive syntax without (required) semicolons.

I'd rather have significant semi-colons than significant whitespace[1]. Don't mix presentation and semantics. 1: http://c2.com/cgi/wiki?SyntacticallySignificantWhitespaceCon...

Just like Python, Haskell only ever has significant indentation.

Re: Such a Little Thing: The Semicolon in Rust

#30
post #8
post #5

Is that really some "special behavior"? As far as i understand the semicolon is just an expression separator like in Erlang and Pascal. In contrast, the semicolon is a statement terminator in C. C uses the comma for expression separation. Practically everything is an expression in Rust, even blocks, so foo() => evaluates to the return value of foo { foo() } => evaluates to the return value of foo { foo(); } => evalua…

It's odd because people think of semicolons as the end of a statement, not a delimiter between statements.

Which is usually wrong.
Post reply on HN