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

Method-like thingies do not work with indirect object notation (&[leg] ‘a’: ‘b’) #5293

Closed
p6rt opened this issue May 3, 2016 · 4 comments

Comments

@p6rt
Copy link

p6rt commented May 3, 2016

Migrated from rt.perl.org#128059 (status was 'rejected')

Searchable as RT128059$

@p6rt
Copy link
Author

p6rt commented May 3, 2016

From @AlexDaniel

This works​:

Code​:
say â��aâ��.&[leg]​: â��bâ��

Result​:
Less

But this does not​:

Code​:
say &[leg] â��aâ��​: â��bâ��

Result​:
===SORRY!=== Error while compiling -e
Confused
at -e​:1
------> say &[leg]â�� â��aâ��​: â��bâ��
  expecting any of​:
  infix
  infix stopper
  postfix
  statement end
  statement modifier
  statement modifier loop

Obviously, this is very important.

@p6rt
Copy link
Author

p6rt commented May 3, 2016

From @TimToady

While semantically this could be made equivalent to the . form, the syntax will not admit it. Apart from .method names with an explicit colon, only bare names (and indeed, only bare names that are not known to be predefined as terms) are allowed to assume they have arguments and expect a subsequent term. All other nouns, including all sigiled forms, are required to expect an infix (possibly with intervening postfixes). In particular, the &foo form is explicitly a noun, not a verb, and will never invoke the function without explicit parentheses (or some higher-order helper function to invoke it on your behalf, such as map). The &[leg] form is merely a variant of the &foo sigiled form in this regard, so cannot be followed by �a�. It never even gets to the point of considering the invocant colon, but fails from a two-terms-in-a-row variety of parsefail. Or looking at it from the other direction, we can't use colon to retroactively change what precedes it from an operator to a term; this would be a forbidden form of multi-pass parsing.

@p6rt
Copy link
Author

p6rt commented May 3, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented May 3, 2016

@TimToady - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed May 3, 2016
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

No branches or pull requests

1 participant