Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] variant with tuple arg in pattern match?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-04-08 (19:46)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: [Caml-list] variant with tuple arg in pattern match?
> On 06-Apr-2001, Xavier Leroy <> wrote:
> > 
> > Frankly, I think there is no point in maintaining the illusion that
> > datatype constructors are either nullary (constant) or unary.  The
> > only efficient implementation model is N-ary constructors, so let's
> > reflect this in the language.
> Sounds good to me.  Now, for consistency, shouldn't you do the same
> for function arguments? ;-)
> -- 
> Fergus Henderson <>  |  "I have always known that the pursuit
>                                     |  of excellence is a lethal habit"
> WWW: <>  |     -- the last words of T. S. Garp.
> -------------------
> To unsubscribe, mail  Archives:

I would suggest the other way round: as we already did for functions,
we should prefer the curried syntax for constructors.

I suggest to explicitely annotate the constructor definitions as in:

type t =
| C : int -> int -> t

This notation is explicit, intuitive, and allows refined type checking
in some cases (for instance
type 'a t = C : int -> bool -> (int * bool) t).

Last but not least, this suggestion is a pure extension of the actual
syntax, compatible with the current notations. (We can still allow the
form ``C of ty'' as a short hand for C of ty -> t).

Hope this helps,

Pierre Weis

INRIA, Projet Cristal,,

To unsubscribe, mail  Archives: