Juerd wrote:
However, the discussion is about changing these simple, clear, and
useful rules to a more complex situation of choosing a default based on
what the default will be used for, making the default for methods the
invocant rather than $_. I hate those plans and would love to see the
current spec, that is as you decribe above, implemented in the "final"
version.
I think your basic error in perception is that $_ is a runtime variable
while the invocant(s) are more a design time assumption of what the
method is working on. Perl6 has invented the notion of topic as a global
lexically scoped variable that is orthogonal to the invocant and non-invocant
parameters of (multi) methods. We have two distinct names for these two
concepts: $_ and $?SELF. Additional multi method invocants need names
anyway.
E.g. in methods of GUI classes the invocant would be the selected widget
and the topic the event.
(Or well, I believed this was the spec until I tried finding it. I can
find the stuff about .method defaulting to $_ in S12, but $_ being an
alias for the invocant is harder to find.)
My reading is that the two concepts have developed concurrently and
only recently some pitfalls were identified when they are combined.
--
TSa (Thomas Sandlaß)