Restrictions of let rec

From: Andreas Rossberg (rossberg@ips.cs.tu-bs.de)
Date: Mon Mar 09 1998 - 17:15:57 MET


Date: Mon, 09 Mar 1998 17:15:57 +0100
From: Andreas Rossberg <rossberg@ips.cs.tu-bs.de>
To: caml-list@inria.fr
Subject: Restrictions of let rec

Hello,

working with OCaml I recently found the following (syntactic?)
restriction quite odd. Consider:

  let rec f = f' some_defaul_arg
  and f' v = function ... -> ...f' v' x... | ... -> ...f y... | ...

The compiler argues that "this kind of expression is not allowed with
`let rec'", probably because the RHS of f is neither an abstraction nor
a constructor application nor does f appear in it.

I know it's easy to avoid this by doing eta conversion, but I don't see
the point in disallowing such definitions. What's the rationale? Maybe
it's an oversight and the compiler should actually check whether f
appears on _any_ RHS of the let rec?

        - Andreas



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