Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Luc Maranget <luc.maranget@i...>
Subject: Re: [Caml-list] Question
> On Thu, 2003-12-11 at 20:52, Luc Maranget wrote:
> 
> > To conclude adopting the Felix way in Ocaml is by no mean a trivial
> > change and benefits are unclear, how many programs do realy use this
> > feature ?
> 
> Well, none in Ocaml because it isn't present :-)
> I have occasionally wanted this, but there is always
> a workaround.
> 
> Basically, I think it would be useful in the following
> situation:
> 
> 	match x with
> 	| A
> 	| (B (j,k) when j=k) -> e1
> 	| B (j,k) -> e2
Hum, I think that you assume this is correct 
provided j and k are not present in e1.

However, this code does not follow the current rules of
bindings in or-pattern: j and k are bound only in the right argument of
the or pattern.

Since using j and k in ``when j=k'' seems legitimate, this means that
the rules of bindings patterns also need to be changed...


> 
> 	match x with
> 	| A i
> 	| B (i,k) when i = k -> ... i ..
> 
Same binding problem, even more clear.
the scoping rules for variable bound in patterns become more complicated.



-- 
Luc Maranget

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners