Thomas Sandlaß skribis 2005-04-25 19:13 (+0200):
> 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.

$_ is the *topic*. Its role in design and thinking is gigantic.

The funny thing is that in this way, the invocant is just that: being
important for design and thinking, and that makes it... a topic.

Following this, considering the topic and the invocant the same thing
works. Until you temporarily change the topic, which means that if you
want the previous topic, you have to be more specific when referring to
it. This is consistent with natural languages as well.

Having two topics, one for the short stuff ($_, sentence) and one for
the long stuff ($self, paragraph) makes sense too. I recall having read
that Japanese had something like that. But making the default thing
you're referring to anything but the most recent (in programming:
innermost) topic, is madness.

(While typing this, I realised that there may be, in English, a
difference between subject and topic. If that's true, please educate
me.)

> E.g. in methods of GUI classes the invocant would be the selected widget
> and the topic the event.

In my thinking, the event would not be named, because it is not
something you operate on. Events just happen - it should be the name of
the method, and the code inside should very rarely need that
information (except when needed to call a supermethod, for example).

The event being the topic makes sense only if all events are handled by
the same method, in which you use a dispatch table. But OO itself is a
pretty neat dispatching machine already.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Reply via email to