On 15/05/05 22:48 +0100, Matthew Walton wrote:
> .
> 
> On 15 May 2005, at 16:17, Rob Kinyon wrote:
> >Right now, P6 has $?SELF and I'm saying that instead of using $?SELF,
> >we should use $self wherever $?SELF would be used. $_ is still the
> >topic and would be the default invocant if you have .method($foo).
> >What I'm saying is that you can have
> >
> >method ( Int foo ) {
> >    $self.otherMethod( foo );
> >}
> >
> >and it will DWIM. Just like Java, C++, and Javascript. (Yes, I'm using
> >JS as part of my argument.)
> >
> >If you have
> >method ( Int foo ) {
> >    .otherMethod( foo );
> >}
> >
> >That would be
> >method ( Int foo ) {
> >    $_.otherMethod( foo );
> >}
> >
> >Just like expected.
> 
> My ill-considered and probably not very understandable thoughts:
> 
> - As has been said with great eloquence earlier, virtually everywhere  
> in Perl 6 so far when you leave something out the default is taken to  
> be $_
> - As has also been said, elsewhere, internal consistency is a great  
> feature of a language people are trying to learn
> 
> Given these two points, in my mind anything other than making
> 
> .method($foo);
> 
> mean
> 
> $_.method($foo);
> 
> is utterly absurd. If it means $_.method($foo) outside a method  
> definition and $?SELF.method($foo) inside one then I think it's a  
> reasonable expectation for people learning Perl 6 to throw up their  
> hands and start complaining loudly (and possibly going back to their  
> previous language of choice).

I don't think that is what Rob is saying at all. My read:

    .method($foo);

always means:

    $_.method($foo);

and

    $self.method($foo);

always means

    $?SELF.method($foo);

The former is consistent with the rest of Perl 6, and the latter is
consistent with most of Perl 5 OO code in the wild.

My only stance is that, given there is no clearly sexy solution, at
least I can take `$self` home to meet my Mom.

Cheers, Brian



Reply via email to