Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005048OCamlCamlp4public2010-05-14 20:032014-08-21 11:24
Reportercfalls 
Assigned Toxclerc 
PrioritynormalSeverityminorReproducibilityalways
StatusassignedResolutionopen 
PlatformOSOS Version
Product Version3.11.2 
Target Versionafter-4.02.0Fixed in Version 
Summary0005048: Labeled arguments parsed differently on camlp4 versus regular compiler
Description# let f ?(foo=()) _x _y z = z;;

With camlp4:
# (f 1 2) ~foo:();;
- : '_a -> '_a = <fun>

Without camlp4:
# (f 1 2) ~foo:();;
- : (foo:unit -> '_a) -> '_a = <fun>
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0005454)
garrigue (manager)
2010-05-15 03:02

In order to handle properly optional arguments, application is n-ary.
That is [(f 1 2) ~foo:()] andf [f 1 2 ~foo:()] are not equivalent.
It looks like camlp4 is merging the two applications into one.

Jacques
(0007753)
cfalls (reporter)
2012-07-13 23:32

There's another issue that I think is just another manifestation of this one. In Core, we define:

let failwithf fmt = ksprintf (fun s () -> failwith s) fmt

Then, [(failwithf "foo" ()) 3] produces a warning about unused arguments only when not using camlp4.

(Note that [failwithf "foo" () 3] doesn't produce the warning in either case. It would be nice if it did, but that's a separate issue.)
(0007966)
hongboz (developer)
2012-08-22 12:23

garrigue is right. camlp4 seems to merge the two applications

- Issue History
Date Modified Username Field Change
2010-05-14 20:03 cfalls New Issue
2010-05-14 20:03 cfalls Status new => assigned
2010-05-14 20:03 cfalls Assigned To => ertai
2010-05-15 03:02 garrigue Note Added: 0005454
2011-10-26 08:44 ertai Assigned To ertai => xclerc
2012-07-10 20:29 doligez Target Version => 4.01.0+dev
2012-07-13 23:32 cfalls Note Added: 0007753
2012-07-31 13:36 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-08-22 12:23 hongboz Note Added: 0007966
2012-09-18 13:16 doligez Target Version 4.00.1+dev => 4.00.2+dev
2013-07-11 12:55 doligez Target Version 4.00.2+dev => 4.01.0+dev
2013-08-12 16:17 doligez Target Version 4.01.0+dev => 4.01.1+dev
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev
2014-08-21 11:24 doligez Target Version 4.02.0+dev => after-4.02.0


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker