Live data from Hacker News

Such a Little Thing: The Semicolon in Rust

lucumr.pocoo.org

11–20 of 81 posts

Re: Such a Little Thing: The Semicolon in Rust

#12
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.

Which keyboard layout is that?

Re: Such a Little Thing: The Semicolon in Rust

#14
post #10

Earlier quoted context omitted.

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.

Which keyboard layout is that?

Swedish is one such keyboard.

Re: Such a Little Thing: The Semicolon in Rust

#15
post #10

Earlier quoted context omitted.

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.

Which keyboard layout is that?

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

Re: Such a Little Thing: The Semicolon in Rust

#16
post #10

Earlier quoted context omitted.

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.

Which keyboard layout is that?

Norwegian. Many european countries use the same placement for semicolon. All the Scandinavian and Baltic countries, Germany and Netherlands to name a few.

Russia uses shift+4. Can't imagine how annoying that is.

Re: Such a Little Thing: The Semicolon in Rust

#17
post #10

Earlier quoted context omitted.

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.

Which keyboard layout is that?

I am going to pay more attention to http://en.wikipedia.org/wiki/Keyboard_layout after this thread!

Re: Such a Little Thing: The Semicolon in Rust

#19
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…

There was some discussion about doing this in D, and there was some in C++11, too. I argued that the presence or absence of the ; did not visually stand out very well, and so would be a source of confusion and errors. Hence, ; remained as a statement terminator, and the return keyword served to indicate returning an expression. However, the D lambda syntax does not require a ; when the lambda body consists of only a…

Ignoring a potentially wanted return value with ";" is a hazard. I'd like to institute some set of "warn-unused-result" warnings in Rust to combat this.

Re: Such a Little Thing: The Semicolon in Rust

#20
post #9

The downside is that you would have to put () (Rust's version of “nil”) in a bunch of functions to fulfil the requirements of the callback's signature since otherwise the type inferred from the function would be the value of the last expression Wouldn't co/contra-variance solve this entirely? It works just fine in Scala for example scala> def runTwice(f: () => Unit) = { | f() | f() | } runTwice: (f: () => Unit)Unit s…

I implemented basically this in Rust, and it was overwhelmingly rejected by the community at the time. People seem to like the strict typechecking.
Post reply on HN