Re: anonymous record types in variants

From: Anton Moscal (msk@post.tepkom.ru)
Date: Tue Feb 16 1999 - 11:57:08 MET


Date: Tue, 16 Feb 1999 13:57:08 +0300 (MSK)
From: Anton Moscal <msk@post.tepkom.ru>
To: Christopher Jeris <cjeris@math.mit.edu>
Subject: Re: anonymous record types in variants
In-Reply-To: <Pine.SUN.4.03.9902121547070.10961-100000@severi.mit.edu>

On Fri, 12 Feb 1999, Christopher Jeris wrote:

> 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}
>

I agree. I often need the following usage of anonymous types:

type text = int(*length*) * (File of string | Str of string | ...)

(factorizing of the common fields in the variant types).

SML allow this construction. Probably an optimal solution would
be to allow anonymous types in any context.

Regards,
Anton Moscal



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