I would be more in favor of this proposal if the semicolon was not optional. Having the ability to have code that is identical except for a semicolon just doesn't feel right to me.

On Thu Aug  2 11:58:03 2012, Patrick Walton wrote:
On 08/02/2012 08:43 AM, Glenn Willen wrote:
But blocks are now allowed to discard their values, where previously
this was forbidden? That is, before, it was an error to say:

fn foo() {
   5
}

But now it will be allowed? (I notice that in your first email you
said that return values could already be ignored -- is my compiler just
out of date on this question?)

Right, this would be allowed.

By return values being ignored I mean that it's possible to write, say:

    fn f() -> int {
        return 3;
    }

    fn g() {
        f();
        f();
    }

And the compiler won't complain or warn about the fact that the int
was dropped.

Patrick

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev


_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to