Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion for-loop signatures, was Re: Fun with multi-dimension arrays
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
 
Dave Whipp  
View profile  
 More options Apr 27 2003, 6:48 pm
Newsgroups: perl.perl6.language
From: d...@whipp.name (Dave Whipp)
Date: Sun, 27 Apr 2003 14:50:48 -0700
Local: Sun, Apr 27 2003 5:50 pm
Subject: Re: for-loop signatures, was Re: Fun with multi-dimension arrays

Luke Palmer wrote:
> All routines that accpet arguments topicalize their first argument
> (considering the invocant an argument on methods), IIRC.  By resorting
> to using the invocant here, you're nullifying all the decisions made
> about -> in A4, which most of us agree were good decisions.  At least
> I think they were.

<quote souce="A4">

   A when is the only defaulting construct that pays attention to the
   current topicalizer regardless of which variable it is associated
   with. All other defaulting constructs pay attention to a fixed
   variable, typically $_. So be careful what you're matching against
   if the given is aliased to something other than $_:

      $_ = "foo";
      given "bar" -> $f {
          if /foo/   { ... } # true, matches against $_
          when /bar/ { ... } # true, matches against $f
      }

</quote>

If I read this carefully, then it implies:

   method foo
   {
     $_ := self # redundant, is bound automatically
     for @.bar -> $f
     {
        if .foo { ... } # calls self.foo
        when .foo {....} # calls $f.foo
     }
   }

Right? So my original example would have worked correctly !?

Dave.


 
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.