RE: anonymous record types in variants

From: Don Syme (dsyme@microsoft.com)
Date: Mon Feb 15 1999 - 11:30:23 MET


From: Don Syme <dsyme@microsoft.com>
To: "'Christopher Jeris'" <cjeris@math.mit.edu>, caml-list@inria.fr
Subject: RE: anonymous record types in variants
Date: Mon, 15 Feb 1999 02:30:23 -0800

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