Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: anonymous record types in variants
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Don Syme <dsyme@m...>
Subject: RE: anonymous record types in variants

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
>