On Fri, Oct 26, 2001 at 01:53:09PM -0500, Jonathan Scott Duff wrote:
> On Fri, Oct 26, 2001 at 01:13:42PM -0400, Aaron Sherman wrote:

> > In Perl6 with the unary ., that becomes:
> > 
> >     sub .foo (*@args) {
> >             my $old = $.{foo};
> >             # So $obj.foo(undef) will work
> >             $.{foo} = shift @args if @args;
> >             return $old;
> >     }
> 
> Actually, I think it becomes:
> 
>       sub foo is method {
>          my $old = .foo;
>          .foo = shift if @_;
>          return $old;
>       }

Gah! How does Perl know the difference between ".foo" the member
and ".foo" the recursive method call?

Also, the "sub .foo" syntax is one I've now seen in an apocolypse and
the good ensign's article, so I'm not sure where "sub foo is method" is
coming from.

> > So, since this is likely to be fairly common, could we perhaps have
> > a shortcut?
> 
> I'm not so sure that a) we need short-cut and b) that one doesn't
> already fall out of existing er, proposed language features.

Which ones?

-- 
Aaron Sherman
[EMAIL PROTECTED]             finger [EMAIL PROTECTED] for GPG info. Fingerprint:
www.ajs.com/~ajs        6DC1 F67A B9FB 2FBA D04C  619E FC35 5713 2676 CEAF
  "Write your letters in the sand for the day I'll take your hand
   In the land that our grandchildren knew." -Queen/_'39_

Reply via email to