That seems like a nice compromise, but I don't think it's a good one.
Either you intended the pattern to be refutable or you didn't. If you
didn't and it is, you should get an error, not a warning. If you did, you
shouldn't get a warning at all. Are you going to put a compiler pragma to
disable the warning at every use site where you intentionally want a let to
be refutable? At that point, you might as well have separate syntax for
refutable and irrefutable lets. Or are you just going to live with having
false positive warnings in your code?

(FWIW, I'm basically fine with having only irrefutable lets, and using
`match` for the other cases, or in other words the status quo. But if we
*do* add refutable lets, I strongly think they should be explicit.)


On Mon, Dec 23, 2013 at 7:03 PM, Carter Schonwald <
carter.schonw...@gmail.com> wrote:

> that seems like a reasonable balance
>
>
> On Mon, Dec 23, 2013 at 12:23 PM, Patrick Walton <pcwal...@mozilla.com>wrote:
>
>> On 12/23/13 4:12 AM, Gábor Lehel wrote:
>>
>>> I don't like either that (a) the possible failure is silent, and
>>> refutable lets look the same as irrefutable ones, nor (b) baking fail!()
>>> into the semantics. Haskell has these also and I think it's a wart. The
>>> proposed syntax solves both issues.
>>>
>>
>> For what it's worth, Rust's pattern matching is pretty heavily based on
>> OCaml's and the OCaml compiler complains with a warning if you use a
>> refutable pattern in `let`.
>>
>
>> Patrick
>>
>>
>> _______________________________________________
>> 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
>
>
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to