RE: anonymous record types in variants

From: Don Syme (dsyme@microsoft.com)
Date: Tue Feb 16 1999 - 18:40:02 MET


From: Don Syme <dsyme@microsoft.com>
To: "'Anton Moscal'" <msk@post.tepkom.ru>,
Subject: RE: anonymous record types in variants
Date: Tue, 16 Feb 1999 09:40:02 -0800

Again, I've also needed to factorize the common fields of variants as in
Anton's example.

BTW, the type language of Mercury (and probably some other FP languages?)
allows variants and records pretty much anywhere in a type structure.

Don

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