Subject: verbs moving locations

From: [email-masked]
Date: Fri, 19 Nov 1993 12:40:31 -0800

As I might have mentionned, I'm designing a simple programming language
for kids built on top of MOO.  It's going to be called MOOSE.  :-)
Pavel is helping me with it.

In MOOSE, you don't need to specify where a verb is.  Suppose your
room has a "silly-word" and you only want your friends to be able to
change the silly word.  In MOOSE this is:

use here
on new-word word
  if player in my friends
	set my silly-word to word
	tell player "Silly word set to "+word
	announce-all "There's a new silly word!"
   else
	tell player "Sorry, you can't change the silly word."
   endif

I'd like to compile this into MOO code.  The MOO code would look like:

@program here:new-word any none none
  if (player in this.friends)
	this.silly_word = dobjstr;
	player:tell("Silly word set to ", dobjstr);
	this.location:announce_all("There's a new silly word!");
  else
	player:tell("Sorry, you can't change the silly word.");
  endif;

In MOO code, you have to specify where a verb is (if it's not a builtin).  At
the command line, you just call a verb, and the parser hunts through a fixed
sequence of objects to find which verb has been called.  MOOSE code is more
like the command line.  Now, here's the question:

Can I find the location of a verb at compile time, or does it have to be done
at run time?

The call to "announce" got compiled to "this.location:announce".  If later I
add a new announce verb higher in the precedence sequence (say on my player
object rather than the room), it isn't going to get called.  There's also some
confusion about how the compiler figured out to call announce on this.location
instead of on the specific room number.

This is really only an issue in cases in which the object the verb is on is
not one of the arguments.  (The room isn't an argument supplied to announce or
say, for example).  In the example of tell, the player is supplied as an
argument, so there's never any confusion.

One solution is to find the location of every verb at run time, not
compile time.  This means I've really got more of an interpreter, rather
than a compiler.  Maybe that's the right thing to do... I'm not sure.

Another solution is to let things behave weirdly under certain unusual
circumstances-- like someone adding a "say" verb to their character.  The code
generated then depends on the compile environment. (Eek!)  So a key question
is: How often do circumstances like that come up?

-- Amy