Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004989OCamlOCaml generalpublic2010-03-01 13:162010-04-18 10:53
Reporterhattori 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusacknowledgedResolutionopen 
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

-  Notes
(0005319)
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.

- 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


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker