Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004989OCaml~DO NOT USE (was: OCaml general)public2010-03-01 13:162017-01-02 16:58
Assigned To 
PlatformOSOS Version
Product Version3.11.1 
Target VersionFixed in Version 
Summary0004989: Compiler rejects recursive definitions of values
DescriptionCompiler 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).
TagsNo tags attached.
Attached Files

- Relationships
related to 0006738resolvedyallop Check for the well-formedness of let rec earlier, before or at type checking 

-  Notes
xleroy (administrator)
2010-04-18 10:53

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.
shinwell (developer)
2016-12-06 22:35

Closing in favour of [^]

- Issue History
Date Modified Username Field Change
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
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker