Such a Little Thing: The Semicolon in Rust
11–20 of 81 posts
Re: Such a Little Thing: The Semicolon in Rust
#12Are 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.
Re: Such a Little Thing: The Semicolon in Rust
#13Re: Such a Little Thing: The Semicolon in Rust
#14Earlier 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?
Re: Such a Little Thing: The Semicolon in Rust
#15Earlier 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?
Re: Such a Little Thing: The Semicolon in Rust
#16Earlier 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?
Russia uses shift+4. Can't imagine how annoying that is.
Re: Such a Little Thing: The Semicolon in Rust
#17Earlier 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?
Re: Such a Little Thing: The Semicolon in Rust
#18Re: Such a Little Thing: The Semicolon in Rust
#19Is 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…
Re: Such a Little Thing: The Semicolon in Rust
#20The 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…