What you're overlooking is that patterns are used for more than just
`match` expressions. They can also be used in both assignment statements
and in function/closure signatures. For example, note that `x` and `y` are
the same type in the following program:

    fn main() {
        let ref x = 3;
        let y = &3;
        foo(x);
        foo(y);
    }

    fn foo(x: &int) {
        println!("{:i}", *x);
    }


Removing the `ref` keyword and making patterns reference by default would
make `let x = 3;` declare a reference to an integer. Then you'd need a new
keyword to express when you don't want this, and you're back at square one.


On Fri, May 30, 2014 at 9:56 AM, Emmanuel Surleau <
emmanuel.surl...@gmail.com> wrote:

> I think the 'ref' keyword removal is a very good idea. It has bitten
> me several times, and the idea that pattern matching something
> essentially performs a side effect (moving the value) leaves me
> uncomfortable.
>
> Cheers,
>
> Emm
> _______________________________________________
> Rust-dev mailing list
> Rust-dev@mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to