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] record declaration, SML
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-01-10 (14:34)
From: brogoff@s...
Subject: Re: [Caml-list] record declaration, SML
On Fri, 10 Jan 2003, Xavier Leroy wrote:
> > There are a few other conveniences in SML record handling too, like the ... 
> > notation, that don't exist in OCaml. 
> You mean, in pattern-matching over records?  Caml offers the same
> functionality without the ... notation, e.g.
>         type r = { x: int; y: int }
>         match r with { x = 1 } -> ...
> Because records are declared in advance, there is no requirement that
> all record labels be mentioned in a pattern matching.

Right, but if I'm not mistaken, SML forces you to use the ... in record 
pattern matching when you want to ignore some labels in the match. As you 
suggest, this is a lot more important in SML, but even in OCaml it would be 
a bit better IMO to explicitly distinguish between ignoring some labels 
and forgetting some, so that slovenly programmers (like yours truly) could 
depend on the type checker to slap them when they miss fields. Unfortunately, 
OCaml behaves as though every record pattern match had an implicit ..., so I 
don't see a good way out even if the developers agreed that this was worth 

File that one under "petty complaints", or, if you're feeling generous in this 
new year, under the non-petty "Oh how I wish we had more polymorphism in 
records!" complaint :-)

-- Brian

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: