[rust-dev] RFC: Ignore trailing semicolons

Patrick Walton pwalton at mozilla.com
Thu Aug 2 08:56:01 PDT 2012

On 08/02/2012 08:31 AM, Benjamin Striegel wrote:
> Ah, so semicolons are absent by default? That seems like the right
> decision; making semicolons optional and yet canonicalizing their
> universal use almost certainly leads to contention down the road (cf
> Javascript).

I think there's a bit of confusion here. This isn't an automatic 
semicolon insertion rule like JS, Scala, or Go have. It's sort of an 
automatic semicolon *deletion* rule if anything. Basically, it makes the 
presence of a semicolon not change the block result value. You still 
need to use semicolons to separate statements, as always.

> I'd be interested to see this happen, but I'd like to see how it works
> with unignorable return values. Do you have a branch that we can play with?

This doesn't implement unignorable return values. I originally thought 
the two issues were intertwined, but they actually aren't; the semicolon 
rules can be relaxed while still allowing return values to be ignored. 
It's a backwards-compatible change for all intents and purposes.


More information about the Rust-dev mailing list