Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
calls and parens
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
 
Juerd  
View profile  
 More options Apr 25 2005, 3:33 pm
Newsgroups: perl.perl6.language
From: ju...@convolution.nl (Juerd)
Date: Mon, 25 Apr 2005 21:33:38 +0200
Local: Mon, Apr 25 2005 3:33 pm
Subject: calls and parens
Which assumptions are wrong?

    foo (3) + 4;    # foo(7)
    foo(3) + 4;     # foo(3)
    foo.(3) + 4;    # foo(3)
    foo .(3) + 4;   # foo(3)

    $foo (3) + 4;   # syntax error
    $foo(3) + 4;    # $foo(3)
    $foo.(3) + 4;   # $foo(3)
    $foo .(3) + 4;  # $foo(3)

    $o.m (3) + 4;   # syntax error
    $o.m(3) + 4;    # m(3)

What do these mean?

    $o.m .(foo)     # m(foo) or m().(foo) ???
    $o.m.(foo)      # m(foo) or m().(foo) ???

In the case of m(foo), m().(foo) is the obvious way to call the returned
sub.

In the case of m().(foo), I would not have any idea how to put
whitespace in between method and opening paren.

This leads me to believe that $o.m.(foo) and $o.m .(foo) are $o.m(foo).

-

Parens cannot be used to group an expression which is then
used as a method name:

    $o.("on_" ~ %methods{$event}).();  # $o(...)

Is there a way to do this without temporary variable?

Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html


    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.
Luke Palmer  
View profile  
 More options Apr 25 2005, 2:40 pm
Newsgroups: perl.perl6.language
From: l...@luqui.org (Luke Palmer)
Date: Mon, 25 Apr 2005 12:40:35 -0600
Local: Mon, Apr 25 2005 2:40 pm
Subject: Re: calls and parens

Juerd writes:
> Which assumptions are wrong?

>     foo (3) + 4;    # foo(7)
>     foo(3) + 4;     # foo(3)
>     foo.(3) + 4;    # foo(3)
>     foo .(3) + 4;   # foo(3)

>     $foo (3) + 4;   # syntax error
>     $foo(3) + 4;    # $foo(3)
>     $foo.(3) + 4;   # $foo(3)
>     $foo .(3) + 4;  # $foo(3)

>     $o.m (3) + 4;   # syntax error
>     $o.m(3) + 4;    # m(3)

none(@above)

> What do these mean?

>     $o.m .(foo)     # m(foo) or m().(foo) ???
>     $o.m.(foo)      # m(foo) or m().(foo) ???

> In the case of m(foo), m().(foo) is the obvious way to call the returned
> sub.

> In the case of m().(foo), I would not have any idea how to put
> whitespace in between method and opening paren.

> This leads me to believe that $o.m.(foo) and $o.m .(foo) are $o.m(foo).

Yep.

> Parens cannot be used to group an expression which is then
> used as a method name:

>     $o.("on_" ~ %methods{$event}).();  # $o(...)

Well, you can't do that anyway.  It has to be:

    $o.::("on_" ~ %methods{$event}).()

Which I believe does the right thing anyway.

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.
End of messages
« Back to Discussions « Newer topic     Older topic »

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