Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Method call parsing
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Luke Palmer  
View profile  
 More options Mar 6 2005, 5:15 pm
Newsgroups: perl.perl6.compiler
From: l...@luqui.org (Luke Palmer)
Date: Sun, 6 Mar 2005 15:15:23 -0700
Local: Sun, Mar 6 2005 5:15 pm
Subject: Method call parsing
In Parser.hs:589, we have the code:

parseParamList parse =    parseParenParamList parse
                      <|> parseNoParenParamList parse

parseParenParamList parse = do
    [inv, norm] <- maybeParens $ parseNoParenParamList parse
    block <- option [] ruleAdverb
    -- XXX we just append the adverbial block onto the end of the arg list
    -- it really goes into the *& slot if there is one. -lp
    processFormals [inv, norm ++ block]

But this allows the syntax '$x.foo $y', that is, an argument to a method
call without parentheses.  This isn't a big deal, and could even be
construed as a feature, if it weren't for:

    for %hash.keys { ... }

Which is misparsed.

Taking out maybeParens and putting 'option [[],[]] $ parens' in its
place makes that part work, but it breaks our regular 'say "foo"'
paren-less syntax.  I would think that the parseParamList rule above
would fix that.  No matter where I put 'try', it never seems to want to
go to parseNoParenParamList.

Luke


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Larry Wall  
View profile  
 More options Mar 7 2005, 3:25 am
Newsgroups: perl.perl6.compiler
From: la...@wall.org (Larry Wall)
Date: Mon, 7 Mar 2005 00:25:42 -0800
Local: Mon, Mar 7 2005 3:25 am
Subject: Re: Method call parsing
On Sun, Mar 06, 2005 at 03:15:23PM -0700, Luke Palmer wrote:

: But this allows the syntax '$x.foo $y', that is, an argument to a method
: call without parentheses.  This isn't a big deal, and could even be
: construed as a feature, if it weren't for:
:
:     for %hash.keys { ... }
:
: Which is misparsed.

Which is why recent versions of A12/S12 outlaw arguments to methods
without parens.  Method calls cannot be parsed with the same rules as
functions and list operators, unfortunately.  The original A12 tried
to make that work, at the expense of arcane lookahead rules, but it
just got too bizarre.  Those braces above *have* to know that they're
where an operator is expected.  Since we can omit method parens on
argumentless method calls and on method calls that have only adverbs,
requiring parens only on methods with extra arguments is a fair price
to pay for dropping parens off of the conditional expression, I think.

[A reminder that implementation followups can certainly go here, but
philosophical followups should probably be rerouted to p6l.  A certain
amount of leakage is necessary, of course, and I don't mind answering
short design clarifications here, as long as they don't clutter the
list with the sorts of idle speculations that are more typical on p6l.]

Larry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google