[
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: | -- (:) |
| From: | skaller <skaller@u...> |
| Subject: | Re: [Caml-list] Patterns that evaluate |
On Thu, 2007-02-15 at 08:41 -0500, Jacques Carette wrote: > skaller wrote: > > It is a common wish, but has many problems IMHO. > > First, it isn't very general. > Fallacious argument: OCaml has records, so there is no need for tuples > which are less general. Yet it has them. It isn't an argument, it's a bullet point. > The point is to balance generality with convenience. Yes, I agree. > > patterns from expressions, would be extremely fragile: > Sure. But that is the normal semantics of the rest of OCaml you're > complaining about here! That's only partly true. In much of ocaml, you can use local construction such as let x = expr in expr which names the variable 'x' to be used in 'expr'. There are issues of hijacking of course. However with the pattern thing, the issue is not *which* definition of x you're referring to, but whether you're referring to one at all -- or actually introducing one. Current patterns have two name classes: pattern match variables (lower case first letter) and constructors (upper case first letter or backtick for polymorphic variants, or perhaps a #term for them). Adding a third category suggests a new lexical mark, to keep the 'kind' of the symbol lexically determinate. [Yes, I know Ocaml implicitly introduces variables not only in patterns .. but also type variables] -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net