On 2013-12-23, at 05:12 , Corey Richardson <[email protected]> wrote:

> I find the ability to have refutable let

I may have missed it, but is there a reason not to have just that? Make
let similar to Erlang’s `=` and fail on refutation?

You said you find the basic let’s irrefutability to be a useful property
but have not explained why, and why it makes sense to introduce a
separate-but-similar construct with subtly different semantics
(I also see this as a possible failure, would users of the language
really expect `let` to be irrefutable and `let [else]` to be refutable,
or would they expect `let [else]` to allow returning a value and `let`
to just fail on mismatch? If such different semantics are desired,
I’d suggest using a different keyword entirely)

> more compelling than the
> ability to work around it with functions wrapping `match`

That assertion seems ill supported so far: just about every example is
in terms of `Option`, and `Option` is the one type which does not need a
refutable let, owing to its truckload of convenience methods covering
just about every basic use cases the only reasons to use a `match` with
Option are personal preferences and insufficient knowledge of the type.

> On Sun, Dec 22, 2013 at 11:00 PM, Carter Schonwald
> <[email protected]> wrote:
>> Agreed!
>> 
>> 
>> On Sunday, December 22, 2013, Ziad Hatahet wrote:
>>> 
>>> But we already have Option::unwrap_or() and Option::unwrap_or_else() that
>>> behave similar to the 'else' syntax suggested above.
>>> 
>>> --
>>> Ziad
>>> 
>>> 
>>> On Sun, Dec 22, 2013 at 10:37 AM, Léo Testard <[email protected]>
>>> wrote:
>>>> 
>>>> Hello,
>>>> 
>>>> Le 22 déc. 2013 à 18:59, Stefan Plantikow <[email protected]> a
>>>> écrit :
>>>> 
>>>>> Hi,
>>>>> 
>>>>> Am 22.12.2013 um 16:47 schrieb Gábor Lehel <[email protected]>:
>>>>> 
>>>>> This is a nice idea.  At first I thought it wouldn’t work with `if` but
>>>>> in expressions `if` requires `else` so the grammar wouldn’t be ambiguous:
>>>>> 
>>>> 
>>>> No, it doesn't. As long as the if's "true block" returns unit.
>>>> let foo = if ... { }; is perfectly legal, even it doesn't make much sense
>>>> in practice.
>>>> 
>>>> Leo
>>>> 
>>>> _______________________________________________
>>>> 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
>> 
> _______________________________________________
> 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