Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Labeled arguments parsed differently on camlp4 versus regular compiler #5048

Closed
vicuna opened this issue May 14, 2010 · 4 comments
Closed

Labeled arguments parsed differently on camlp4 versus regular compiler #5048

vicuna opened this issue May 14, 2010 · 4 comments

Comments

@vicuna
Copy link

vicuna commented May 14, 2010

Original bug ID: 5048
Reporter: cfalls
Assigned to: @xclerc
Status: closed (set by @damiendoligez on 2015-01-09T18:47:40Z)
Resolution: suspended
Priority: normal
Severity: minor
Version: 3.11.2
Target version: undecided
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Monitored by: @glondu @hcarty

Bug description

let f ?(foo=()) _x _y z = z;;

With camlp4:

(f 1 2) ~foo:();;

  • : '_a -> '_a =

Without camlp4:

(f 1 2) ~foo:();;

  • : (foo:unit -> '_a) -> '_a =
@vicuna
Copy link
Author

vicuna commented May 15, 2010

Comment author: @garrigue

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

@vicuna
Copy link
Author

vicuna commented Jul 13, 2012

Comment author: cfalls

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.)

@vicuna
Copy link
Author

vicuna commented Aug 22, 2012

Comment author: @bobzhang

garrigue is right. camlp4 seems to merge the two applications

@vicuna
Copy link
Author

vicuna commented Jan 9, 2015

Comment author: @damiendoligez

Transferred to camlp4/camlp4#70

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant