anonymous record types in variants

From: Christopher Jeris (cjeris@math.mit.edu)
Date: Fri Feb 12 1999 - 21:53:57 MET


Date: Fri, 12 Feb 1999 15:53:57 -0500 (EST)
From: Christopher Jeris <cjeris@math.mit.edu>
To: caml-list@inria.fr
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



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:19 MET