Browse thread
anonymous record types in variants
- Christopher Jeris
[
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: | Christopher Jeris <cjeris@m...> |
| Subject: | anonymous record types in variants |
(Sorry only in English.)
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