Version française
Home     About     Download     Resources     Contact us    
Browse thread
partial match in let
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dan Grossman <djg@c...>
Subject: Re: [Caml-list] partial match in let

Oops, a bit too hasty on the send (flaky mail reader):

let (x,y) = (match f(x) with [x1;y1] -> (x,y) | _ -> assert false) in foo

Dan Grossman wrote:

> 
> let g x = match f(x) with [x1;y1] -> (x,y) | assert false
> let (x,y) = g x in foo
> 
> Christophe Raffalli wrote:
> 
>>
>> Wish: I had like a way to avoid the partial match warning in code like
>>
>> let [x;y] = f (x) in foo
>>
>> Because if foo is long writing
>>
>> match f(x) with [x;y] -> foo | _ -> assert false
>>
>> is really ennoying, especially if you have a long sequence of let.
>>
>> I find usefull the partial match warning for match and function but 
>> not for let (if you write a let, I think you are aware that your 
>> matching will be partial for any data type with more than one 
>> constructor, you do not need a warning)
>>
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs