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

Re: ./method

Thread Previous | Thread Next
From:
Autrijus Tang
Date:
May 15, 2005 06:38
Subject:
Re: ./method
Message ID:
20050515121649.GA91256@aut.dyndns.org
On Sun, May 15, 2005 at 01:44:44PM +0200, Juerd wrote:
> I suggest
>     ./method
> to mean $?SELF.method
> 
> Your opinions please! (I ask those who already responded off-list, to
> repeat their opinion here)

I like it.  Tentatively implemented as r3253 for people to experiment
with.  The converted examples/games/wizard.p6 looks good; the relevant
snippet is paraphrased below:

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

Thanks,
/Autrijus/

Thread Previous | Thread Next


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