develooper Front page | perl.perl6.language | Postings from May 2005

Re: ./method

Thread Previous
From:
Ashley Winters
Date:
May 15, 2005 15:45
Subject:
Re: ./method
Message ID:
cda42dbb05051515456340f1c1@mail.gmail.com
On 5/15/05, Autrijus Tang <autrijus@autrijus.org> wrote:
> On Sun, May 15, 2005 at 01:44:44PM +0200, Juerd wrote:
> > I suggest
> >     ./method
> > to mean $?SELF.method

Sounds good.

>     class Person is Mortal {
>         has Weapon %.weapons;
>         ...
>         method battle_choice (Monster $enemy) {
>             given prompt("Your choice?") {
>                 when %.weapons {
>                     ./attack($enemy, $.weapons{$_});
>                 }
>             }

Looks good, too. It's convenient enough to encourage me to use it
consistently. Even when $_ points at the invocant, I'd be strongly
inclined to use ./method for $self.method. After a decade of using
unix shells, typing ./ is closer to huffman(1.1) than huffman(2).

This is a really clean solution.

Ashley Winters :vote<yea>

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About