Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler rejects recursive definitions of values #4989

Closed
vicuna opened this issue Mar 1, 2010 · 2 comments
Closed

Compiler rejects recursive definitions of values #4989

vicuna opened this issue Mar 1, 2010 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Mar 1, 2010

Original bug ID: 4989
Reporter: hattori
Status: closed (set by @mshinwell on 2016-12-06T21:36:06Z)
Resolution: suspended
Priority: normal
Severity: feature
Version: 3.11.1
Category: ~DO NOT USE (was: OCaml general)
Related to: #6738

Bug description

Compiler rejects thw following definition:

let rec f = let g = fun x -> f x in g;;

Error: This kind of expression is not allowed as right-hand side of `let rec'

However, the following definition is OK:

let rec f = let g = f in fun x -> g x;;

val f : 'a -> 'b =

It seems that the first definition is also OK according to the reference manual (section 7.3).

@vicuna
Copy link
Author

vicuna commented Apr 18, 2010

Comment author: @xavierleroy

The checking of recursive value definitions is syntactic in nature and rather subtle. In your case, the criteria used do not distinguish between your example and "let rec f = let g = f in g", which would be semantically ill-defined indeed (just like "let rec f = f").

I'll keep this PR as a feature wish, but I'm afraid it's not going to be addressed any time soon.

@vicuna
Copy link
Author

vicuna commented Dec 6, 2016

Comment author: @mshinwell

Closing in favour of #556

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant