MOO-cows Mailing List Archive


Re: Scope resolution operator

At 11:25 AM 1/12/96 PST, it was seem on this list:
>> A new pass() function that lets you specify whichj parent to pass() to
>> could be incredibly useful.  Let's say you don't trust your PC owner
>> not to mess with your :confunc (and you don't want to change player

Er, right there I see a problem.  If you don't trust your PC owner, then
don't be a child of their player class.

>> classes just yet).
>> @program me:confunc
>> return pass_to($player, @args);
>> .
>> Skipping all intermediate parents, keeping the value of 'this' intact,
>> and bypassing any evil stunts that may lie inbetween.
>This sounds (slightly) more useful, since pass()ing is slightly different
>from simply calling the verb as the scope operator above would do.  Again,
>what should pass_to(parent, @args) return if this isn't a child of parent?

E_INVARG.  That's like asking what pass() returns when the parent is #-1
(E_INVIND), or what pass() returns when no ancestors define the verb we are
passing to (E_VERBNF).

>Also, it means that any time you change the inheritance structure of the MOO,
>or renumber the objects, you'll have to edit any code containing pass_to()
>constructs to reflect the changes, making things even less portable than

This is hardly an argument, since if I have a note that overrides and
pass()es to $thing:drop, and I change the parent of that note from $note to
$player, that code needs to be changed.  Since when did changing the
ancestors of an object become a such a small change such that it *doesn't*
require examination of the code?  

If you only want skip the parent of the object, then:

pass_to(parent(parent(this)), @args);

What this has to do with renumbering, I do not know.  You should NEVER have
hard coded object numbers in production code, no excuses.

>they already are.  Might as well just perform parent:(verb)(@args) and
>have parent:(verb) check that caller is a descendant.

The problem with this is that 'this' will not be set correctly.  But never
mind that if you don't want to use overriden verbs on the child and never
refer to properties in your code.  This idea would be great for fart
bonkers, since all they do is print text (but then, fart bonkers rarely have
children, don't need to pass(), and are pretty useless anyway).

I find the whole idea of this 'pass_to' or scope operating to be of dubious
utility.  Kind of defeats the purpose of OO, I'd say.  But I do think the
option to make some verbs non-overrideable is a good one.


Home | Subject Index | Thread Index