Re: [rust-dev] Two small syntax change proposals.

2011-09-15 Thread Marijn Haverbeke
B) Limiting implied-semicolons-after-blocks to blocks that end with a trailing semicolon, requiring blocks in loops (where the value is discarded anyway) to end in a trailing semicolon, and always treating blocks that do end in semicolons as the end of the expression. I went ahead and

Re: [rust-dev] Two small syntax change proposals.

2011-09-14 Thread Marijn Haverbeke
This one is ... a confusing set of rules. I take it empty loops have an implied trailing semi in their body? That is: while true {}? I know it's a degenerate case, just trying to clarify. {} is a non-expression block. The phrase 'trailing semicolon' was badly picked. The deciding factor is

Re: [rust-dev] Two small syntax change proposals.

2011-09-14 Thread Marijn Haverbeke
Thoughts? So do you intend to make bracey-if a statement? What about expression-alt? That'd still have the current awkwardness when followed by '(' or '['. ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

Re: [rust-dev] Two small syntax change proposals.

2011-09-14 Thread Patrick Walton
On 9/14/11 10:55 AM, Marijn Haverbeke wrote: Thoughts? So do you intend to make bracey-if a statement? What about expression-alt? That'd still have the current awkwardness when followed by '(' or '['. Oh right, alt too. Maybe ML-style alt as well: let x = alt y of some(z) { z } |

Re: [rust-dev] Two small syntax change proposals.

2011-09-14 Thread Graydon Hoare
General responses: - The if/then/else form of if-exprs will not satisfy ternary users, I imagine, and requires a bunch of lookahead to find the 'then'; I don't particularly like the look of it. - Doesn't solve 'alt', does it? - Still requires the do { ... } block, no? - I believe a

Re: [rust-dev] Two small syntax change proposals.

2011-09-14 Thread Patrick Walton
On 9/14/11 11:00 AM, Graydon Hoare wrote: General responses: - The if/then/else form of if-exprs will not satisfy ternary users, I imagine, and requires a bunch of lookahead to find the 'then'; I don't particularly like the look of it. - Doesn't solve 'alt', does it? - Still requires the do {

Re: [rust-dev] Two small syntax change proposals.

2011-09-14 Thread Patrick Walton
On 9/14/11 11:10 AM, Patrick Walton wrote: Fair enough; if others don't like separate expression and statement forms, I'd vote for |val| for block-expression, without the |res| (it's an interesting idea, but I'm not sure it's necessary -- maybe something to think about for future versions?) I

[rust-dev] Two small syntax change proposals.

2011-09-13 Thread Marijn Haverbeke
Would anyone be opposed to... A) Marking 'free' blocks (blocks not part of a function/loop/if/alt/etc, but used solely for a new scope or to do something before an expression) with a more explicit syntax. This has the advantage of making them easier to spot and parse (distinguishing '{ foo; bar;