Browse thread
Restrictions of let rec
- Andreas Rossberg
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Andreas Rossberg <rossberg@i...> |
| 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