MOO-cows Mailing List Archive
[Prev][Next][Index][Thread]
Scattering
-
Date: Sat, 27 Jan 1996 01:46:39 PST
-
From: Michael Brundage <anomaly@u.washington.edu>
-
Content-Transfer-Encoding: 7bit
-
Content-Type: text/plain; charset=US-ASCII
I really love the new scattering and try/except/endtry constructs. It's fun
to re-implement icky Lambda routines with these new friends.
However, I do have a suggestion/wish: It would be nice, in the scattering
assignment, to be able to require the targets to evaluate to a certain type.
This would further reduce the code necessary to evaluate arguments.
For example, if you implemented $object_utils:has_verb as
@program foo:has_verb tnt rxd
"Usage: has_verb(object, verb)";
"Return whether object has a definition of verb anywhere in the hierarchy";
{target, vname} = args;
try
verb_info(target, vname);
return {target};
except(E_VERBNF)
return this:has_verb(parent(target), vname);
except(ANY)
return 0;
endtry
.
Then you might like also to make sure that typeof(target)==OBJ and
typeof(vname)==STR, but this currently requires an if statement. How about
including this somehow in the scattering assignment? Perhaps something like
{OBJ target, STR vname} = args;
?? Then after checking whether E_ARGS should be raised, it could check
whether any assignments resulted in a type mismatch, and return E_INVARG
if necessary...
michael
Home |
Subject Index |
Thread Index