Date: Fri, 27 Aug 1999 12:12:54 +0200
From: Jerome Vouillon <Jerome.Vouillon@inria.fr>
To: Jacques GARRIGUE <email@example.com>,
Subject: Re: Weird behavior with mutually recursive type definitions
In-Reply-To: <19990813104206X.firstname.lastname@example.org>; from Jacques GARRIGUE on Fri, Aug 13, 1999 at 10:42:06AM +0900
On Fri, Aug 13, 1999 at 10:42:06AM +0900, Jacques GARRIGUE wrote:
> I personnaly think that, like for polymorphic recursion, the semantics
> could be changed so that the user has to write explicitely the
> constraints. In type definitions, this makes sense. If a constraint
> appears to be needed somewhere and was not declared, there would be an
> error. Technically this would probably mean doing two passes on type
> definitions: one to introduce definitions (polymorphically) and one to
> check the constraints. In such a way, one could avoid this strange
> side-effect of the object system on the rest of the language.
> Comments, Jerome ?
This would indeed be much less confusing. It is not clear to me how
this can be done, though.
An alternative would be that the compiler automatically sorts the type
definitions so as to eliminate as much mutual recursion as possible.
Then, all correct type abbreviations could be defined using mutually
recursive type definitions and the user would not have to reorder
manually the definitions.
Type representations are already typed after the type abbreviations
have been computed, which explains why the following definition is
type 'a t = 'a and u = A of int t and v = B of bool t;;
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:24 MET