Questions:

1) Are there any complications with spanning multiple lines?
```
let foo = bar + baz + "some long string literal that takes us out to 80
chars"
          + qux + "and continued on this line"
do something_else { ...
```

2) What is the official style?

On Wed, Aug 1, 2012 at 11:47 PM, Patrick Walton <[email protected]> wrote:

> On 08/01/2012 07:03 PM, Glenn Willen wrote:
>
>> I for one liked the clear and unambiguous rule: semicolon discards
>> value, no-semicolon returns value.
>>
>> The idea of allowing uniform semicolon use is appealing, but it does
>> seem to add complexity and mysteriousness.
>>
>
> Actually, the only parser change was to throw away semicolons before the
> end of the block.
>
> To be more concrete, the rules are:
>
> 1. The last expression is the value of the block, regardless of whether
> there's a semicolon after it. (This seems like a simplification to me.)
>
> 2. "Statement positions" are defined as the position of any expression
> immediately before a ";" (if that ";" has anything after it) and the last
> value of a function declared to return unit. Given that:
>
> 3. The type of an expression in a statement position is ignored.
>
> 4. The types of the arms of a pattern match and the bodies of if/else
> statements in statement position are ignored.
>
> I think the rules are pretty simple, but I'm biased :)
>
> Also, the pretty printer will never write a semicolon after an expression
> in trailing position, so if you like the visual consistency the pretty
> printer will preserve it for you.
>
> (Somewhat surprised at the response here, actually; this thread from 8
> months ago [1] had near-unanimity the other way!)
>
> Patrick
>
> [1]: https://mail.mozilla.org/**pipermail/rust-dev/2012-**
> January/001263.html<https://mail.mozilla.org/pipermail/rust-dev/2012-January/001263.html>
>
>
> ______________________________**_________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/**listinfo/rust-dev<https://mail.mozilla.org/listinfo/rust-dev>
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to