Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005342OCamlOCaml generalpublic2011-08-18 16:172011-12-14 10:22
Reporterelnatan 
Assigned Togarrigue 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.12.0 
Target VersionFixed in Version3.13.0+dev 
Summary0005342: "Optional argument cannot be erased" warning is not issued when an optional argument is followed only by labeled arguments
DescriptionAn optional argument that is followed by labeled arguments but by no anonymous arguments cannot be erased, but no warning is issued.

# let f ?x ~y = x,y;;
val f : ?x:'a -> y:'b -> 'a option * 'b = <fun>
# f ~y:();;
- : ?x:'a -> 'a option * unit = <fun>
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0006102)
lavi (reporter)
2011-08-24 17:04

Well, It can be erased, but without any label:

# let f ?x ~y = x,y;;
val f : ?x:'a -> y:'b -> 'a option * 'b = <fun>
# f 1;;
- : 'a option * int = (None, 1)
(0006221)
garrigue (manager)
2011-12-10 04:19

As pointed out in the note, in can be erased by passing all non-optional arguments without labels.
(0006248)
elnatan (reporter)
2011-12-12 19:47

This is true, but then I think the manual needs correction: http://caml.inria.fr/pub/docs/manual-ocaml/manual006.html [^] says, 'A function taking some optional arguments must also take at least one non-labeled argument.'

Also, when warning 6 ('labels were omitted in the application of this function.') is treated as an error, it would helpful to have the unerasable optional argument warning when an optional argument is followed by only labeled arguments.
(0006286)
garrigue (manager)
2011-12-14 10:22

Fixed the manual, revision 11310.

- Issue History
Date Modified Username Field Change
2011-08-18 16:17 elnatan New Issue
2011-08-24 17:04 lavi Note Added: 0006102
2011-12-10 04:19 garrigue Note Added: 0006221
2011-12-10 04:19 garrigue Status new => closed
2011-12-10 04:19 garrigue Assigned To => garrigue
2011-12-10 04:19 garrigue Resolution open => no change required
2011-12-12 19:47 elnatan Note Added: 0006248
2011-12-12 19:47 elnatan Status closed => feedback
2011-12-12 19:47 elnatan Resolution no change required => reopened
2011-12-14 10:22 garrigue Note Added: 0006286
2011-12-14 10:22 garrigue Status feedback => closed
2011-12-14 10:22 garrigue Resolution reopened => fixed
2011-12-14 10:22 garrigue Fixed in Version => 3.13.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker