Re: As-binding #-types

Jerome Vouillon (vouillon@clipper.ens.fr)
Thu, 12 Sep 1996 13:56:44 +0200 (MET DST)

Date: Thu, 12 Sep 1996 13:56:44 +0200 (MET DST)
From: Jerome Vouillon <vouillon@clipper.ens.fr>
Subject: Re: As-binding #-types
To: Frank Christoph <christo@nextsolution.co.jp>
In-Reply-To: <9609120953.AA00876@sparc3.nextsolution.co.jp>
Message-Id: <Pine.3.89.9609121339.A13757-0100000@vedette>

> #type 'a mytype = Mk of #myclass as 'a;;
> Unbound row variable in #myclass

In a type definition, type parameters *must* be free variables. But, here,
you try to bind the type parameter 'a to #myclass. So, this definition
fails. Actually, the compiler sees that #myclass contains a row variable
that obviously cannot be a type parameter, and hence rejects this phrase.

You can remove the constraint and just write
#type 'a mytype = Mk of 'a;;
I don't think omitting the type constraint is a problem in practice.

However, I plan to add constrained type definitions to the language in the
future. Then you will probably be able to write your type definition as
#type (#myclass as 'a) mytype = Mk of 'a;;

Jerome