|Anonymous | Login | Signup for a new account||2017-01-18 11:07 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004989||OCaml||OCaml general||public||2010-03-01 13:16||2017-01-02 16:58|
|Target Version||Fixed in Version|
|Summary||0004989: Compiler rejects recursive definitions of values|
|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 = <fun>
It seems that the first definition is also OK according to the reference manual (section 7.3).
|Tags||No tags attached.|
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.
|Closing in favour of https://github.com/ocaml/ocaml/pull/556 [^]|
|2010-03-01 13:16||hattori||New Issue|
|2010-04-18 10:53||xleroy||Note Added: 0005319|
|2010-04-18 10:53||xleroy||Severity||minor => feature|
|2010-04-18 10:53||xleroy||Status||new => acknowledged|
|2016-12-06 22:35||shinwell||Note Added: 0016676|
|2016-12-06 22:36||shinwell||Status||acknowledged => closed|
|2016-12-06 22:36||shinwell||Resolution||open => suspended|
|2017-01-02 16:58||yallop||Relationship added||related to 0006738|
|Copyright © 2000 - 2011 MantisBT Group|