# call_function() and $bf_FOO()

Don Schwarz (darkowl@darkowl.pr.mcs.net)
Sat, 27 Apr 1996 17:43:48 PDT

- Messages sorted by:[ date ][ thread ][ subject ][ author ]

    I realize that it's too late for Pavel to make this change, but I think
    that a few changes should be made to the way call_function() and
    $bf_FOO() are implemented.

      1) The server should change any calls to call_function(foo, ...), where
    foo is a literal string and represents a valid built-in function, back into
    a standard built-in call (yes again, but #2 will fix the reason Pavel
    decided not to implement this before).

      2) When programming verbs (with set_verb_code or .program), any built-in
    calls where the function is not known should be changed into call_function()
    calls, similar to what it does when loading the DB, except that instead of
    sending the warning to the log, it should somehow notify the programmer
    (maybe by notify()ing the player, even though that's probably a bad idea).

      3) call_function() should be changed so that if the first argument isn't
    a known built-in function, it checks to see if a callable verb is defined on
    #0 with the name bf_<name of function>, which will be called in the same way
    that it would be if the function existed and was protected.  This will allow
    people to do something like:
        #0:bf_listassoc this none this rxd
          try
            return call_function("listassoc", @args);
          except e (E_INVARG)
            return $list_utils:assoc(@args);
          endtry
    and have the listassoc() built-in work whether the patch was installed or
    not.

    Oh, and while I'm at it, shouldn't the MOO panic when #0 is recycled?  Or
    maybe just make recycle() refuse to recycle it?  I don't see how the MOO
    could function at all without #0, nor do I see any reason why it should
    ever need to be recycled.  Of course recycling $player could probably do
    just as much damage, but the server doesn't directly communicate with
    $player like it does with #0.
                                                     --Dark_Owl