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

FTR, I've also had a few situations where it seemed most natural to write
similar constructs, but I couldn't.

Cheers,
Don
> 
> 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
>