Version française
Home     About     Download     Resources     Contact us    
Browse thread
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: Anton Moscal <msk@p...>
Subject: Re: anonymous record types in variants


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