From: Manuel Fahndrich <maf@microsoft.com>
To: caml-list@inria.fr
Subject: RE: anonymous record types in variants
Date: Mon, 15 Feb 1999 10:03:39 -0800
I also find this the major annoying feature of CAML records. I frequently
use variant datatypes with a number of fields. Without records, the field
order matters and has to be remembered when creating and accessing such
variants. Anonymous records would be ideal on variants, since they would not
introduce the extra level of indirection that you get when you declare an
explicit record type.
-Manuel
-----Original Message-----
From: Don Syme [mailto:dsyme@microsoft.com]
Sent: Monday, February 15, 1999 2:30 AM
To: 'Christopher Jeris'; caml-list@inria.fr
Subject: RE: anonymous record types in variants
FTR, I've also had a few situations where it seemed most natural to write
similar constructs, but I couldn't.
Cheers,
Don
>
> The argument of a variant type constructor cannot be an
> anonymous record
> type, i.e.:
>
> type foo = One of {one: int} | Two of {two: string}
>
> is rejected at the first {. Of course this is easy to work
> around, just
> give the record types names:
>
> type foo_one = {one: int}
> type foo_two = {two: string}
> type foo = One of foo_one | Two of foo_two
>
> But, just out of curiosity, is there a quick explanation of
> why it is this
> way?
>
> thanks & peace,
>
> Chris Jeris MIT math grad student and novice OCaml music programmer
>
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:19 MET