MOO-cows Mailing List Archive


Re: Scope resolution operator

>Is there any chance we could get a scope resolution operator or
>function for MOO?  With that, we could properly implement many things
>that have to use $utils now, i.e.
>$perm_utils:controls(obj, who) ---> obj:$root_class::trusts(who)

And if obj isn't a child of $root_class?  Also, why not just do
$root_class:trusts(who)?  Why is a scope operator needed at all?
Or do you mean that `$root_class := highest valid ancestor in obj's
hierarchy' (in which case the notation $root_class is not too great,
and in fact you could just do obj::trusts(who) or something)?
I don't really see any advantages here.

> 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
> 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?
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
they already are.  Might as well just perform parent:(verb)(@args) and
have parent:(verb) check that caller is a descendant.



Home | Subject Index | Thread Index