On Fri, 5 May 2023 11:58:56 +0100 Dave Mitchell <davem@iabyn.com> wrote: > Note that in Perl 6 and some CPAN signature modules, the 'method' > keyword declares an implicit $self parameter, whose name can be > overridden using a postfix ':': > > method foo($x, $y) { $self->{$x} = $y } # implicit $self > method foo($me: $x, $y) { $me->{$x} = $y } # explicit invocant > > I have no plans to introduce such a 'method' keyword, but if we did, > we might need different syntax for the invocant, as the ':' would be > interpreted as the start of an attribute unless the toker was clever > and we are very careful that all signature syntax is capable of being > disambiguated. A quick note on that part - the newly-added `method` keyword doesn't allow you to rename the invocant variable at all. You just get `$self`, so there's no such syntax ambiguity here to worry about. -- Paul "LeoNerd" Evans leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/Thread Previous | Thread Next