Here's an idea I've been considering. Often it's frustrating when the traditional verb 
matching sequence causes one over-general verb to hide other verbs later in the chain. 
Eg: The Coat Closet (#11) has an "open any none none" verb, which calls :invoke() on 
the exit if you type "open door". And it gives an error for every other "open <obj>" 
command, even if you're carrying an object with an "open this" verb.

This is a nuisance. And it happens all over the MOO. I propose a solution: create a 
new exception E_REPARSE. This exception is to be thrown when a verb decides that it 
has been called with arguments that are no appropriate to it. It can be caught in the 
usual way, but if it goes uncaught all the way back to the parser, then rather than 
giving a backtrace, the parse just moves on to the next possible match in the standard 
parse sequence.

This seems to be a neat solution to me: it won't break any existing code, but it will 
make future code much more flexible. Feature-handling code like $player:my_huh could 
catch this exception and continue searching for a matching feature. If you want you 
could include a message with the exception, which the parser could print if it didn't 
find another matching verb.

So for instance, $command_utils:player_match_failed() could be rewritten as:

{match_result, string} = args;
msg = "";
if (index(string, "#") == 1 && $code_utils:toobj(string) != E_TYPE)
  "...avoid the `I don't know which `#-2' you mean' message...";
  if (!valid(match_result))
    msg = tostr(string, " does not exist.");
  endif
elseif (match_result == $nothing)
  msg = "You must give the name of some object.";
elseif (match_result == $failed_match)
  msg = tostr("I see no \"", string, "\" here.");
elseif (match_result == $ambiguous_match)
  msg = tostr("I don't know which \"", string, "\" you mean.");
elseif (!valid(match_result))
  msg = tostr(match_result, " does not exist.");
endif
if (msg)
  raise(E_REPARSE, msg)
endif
return 1;

Anyway, it's just a thought. I guess I could try to add this feature myself. 
I've been poking around the server code, but I'm not confident to change
anything just yet. Any pointers as to where I should be looking to make
a change like this?

Malcolm

-- 
Malcolm Ryan - [EMAIL PROTECTED] - http://www.cse.unsw.edu.au/~malcolmr/

                         "Blessed are those who mourn,
                          for they will be comforted."          -- Matt 5:4

#############################################################
This message is sent to you because you are subscribed to
  the mailing list <[EMAIL PROTECTED]>.
To unsubscribe, E-mail to: <[EMAIL PROTECTED]>
To switch to the DIGEST mode, E-mail to <[EMAIL PROTECTED]>
To switch to the INDEX mode, E-mail to <[EMAIL PROTECTED]>
Send administrative queries to  <[EMAIL PROTECTED]>

Reply via email to