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

A required positional after an optional positional is an error. #110

Merged
merged 1 commit into from Sep 20, 2014

Conversation

schwern
Copy link
Contributor

@schwern schwern commented Sep 14, 2014

As documented...

  • If one positional param is optional, everything to the right must be
    optional

    method foo($a, $b?, $c?) # legal

    method bar($a, $b?, $c) # illegal, ambiguous

    Does "->bar(1,2)" mean $a = 1 and $b = 2 or $a = 1, $c = 3?

A required positional after a slurpy technically falls under this, but gets
its own specific error message elsewhere. This is good because "slurpy
args can only come last" is the information the user needs.

For #108

As documented...

   * If one positional param is optional, everything to the right must be
   optional

       method foo($a, $b?, $c?)  # legal

       method bar($a, $b?, $c)   # illegal, ambiguous

   Does "->bar(1,2)" mean $a = 1 and $b = 2 or $a = 1, $c = 3?

A required positional after a slurpy technically falls under this, but gets
its own specific error message elsewhere.  This is good because "slurpy
args can only come last" is the information the user needs.
barefootcoder added a commit that referenced this pull request Sep 20, 2014
A required positional after an optional positional is an error.
@barefootcoder barefootcoder merged commit 15d4be0 into master Sep 20, 2014
@barefootcoder barefootcoder deleted the issue/108 branch September 20, 2014 23:33
barefootcoder added a commit that referenced this pull request Sep 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants