Browse thread
partial match in let
-
Christophe Raffalli
- Dan Grossman
- Dan Grossman
- Robert W.
- luc.maranget@i...
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2004-11-30 (14:05) |
From: | luc.maranget@i... |
Subject: | Re: [Caml-list] partial match in let |
> > 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) > > -- > Christophe Raffalli I think the warning clearly is useful even in this situation of a pattern in let. In fact it can even be argued that 'let pat = exp in exp' should be legal only when 'pat' provable cannot fail. And the is camlp4 'revised syntax' approach, as far as I remember. I also remark that your sentence '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' Does not apply to novices or in case of type alteration. Besides a simple solution using a function has been given. Cheers, -- Luc Maranget