I should add that Darren and I, who both have similar tendencies towards larger scale coding where consistency is far preferred to compactness, both ended up concluding that our style policies will be to _always_ use explicit invocants (except of course for one liners).

In the case of the Algorithm::Dependency module that is being ported over as a test, and given that larger chunks of code have a tendency towards named iterators in loops anyways, and we've ended up with the only sane way to be the wordiest of the various ways-to-do-it.

Just for the record, I for one would have much preferred to have .foo be the same as $.foo and @.foo and %.foo and refer to the invocant method, at the cost of using C< map { $_.foo } >.

To describe it in emotional terms, the current situation feels "backwards and inside out".

Adam K

Michael G Schwern wrote:
There's a discussion going on #perl6/irc.freenode.org right now wondering
about what .method means. We'd all assumed it meant $self.method (where
$self is always the method invocant) but then had a look at Synopsis 12 which states

  Dot notation can omit the invocant if it's in $_:


This seems to cripple .method's usefulness by coupling it to $_ which
can change often. Now in order to be safe for anything but trivial methods you're back to writing out $self all over the place, something that Perl 6 was supposed to fix about Perl 5.

It has also been pointed out that .foo, $.foo, @.foo and %.foo are all
(intentionally) similar and all but one operates on the invocant.  Only
.foo operates on $_.  This seems like a newbie trap waiting to happen.
MOST of the time .foo will work like $self.foo but every once in a while
they'll get caught in a gotcha.


Reply via email to