Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
RE: [Caml-list] strange behaviour with variants and "cannot be g eneralized"
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@o...>
Subject: RE: [Caml-list] strange behaviour with variants and "cannot be g eneralized"
On Wed, 2003-09-10 at 18:18, Jacques Garrigue wrote:
> From: "Beck01, Wolfgang" <>

>  In that case we have now polymorphic fields.
>       type mix = {data: 'a. 'a -> 'a ; mutable count: int}
>       let r = {data = (fun x -> x); count = 0}
> So, I think this is a good idea in itself, but before I try again
> introducing this improvement, I need a few compelling examples to
> justify the effort.

Curious: this isn't yet dual to the variants: the field values
are polymorphic, by the record itself is not. Wouldn't one like
to have a record of a set of tags where the typing is like:

	match { `A 1; `B 2 } with
	| { `A x } -> ...

that is, allow subtyping based on tag sets?
[Hmm .. what is the variance of the field values ?]

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: