Re: Why is this not allowed?

From: John Prevost (prevost@maya.com)
Date: Thu Dec 02 1999 - 19:40:44 MET


To: Damien Doligez <Damien.Doligez@inria.fr>
Subject: Re: Why is this not allowed?
From: John Prevost <prevost@maya.com>
Date: 02 Dec 1999 13:40:44 -0500
In-Reply-To: Damien Doligez's message of "Thu, 2 Dec 1999 12:13:32 +0100"

Damien Doligez <Damien.Doligez@inria.fr> writes:

> ># let rec id'' = id;;
> >This kind of expression is not allowed as right-hand side of `let rec'
>
> Because we don't know how to compile "let rec x = x" or
> let rec x = y
> and y = x
>
> Moreover, you can just remove the "rec" and it works. It is possible
> to implement "let rec var1 = var2", but the usefulness is quite small
> compared to the amount of code we would need to write.

Well, you can't quite. Because of the value restriction, id'' defined
like this:

let id'' = id;;

has type:

id'' : '_a -> '_a

(That is, it'll only work for a single type.)

John.



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:29 MET