[DGD] undefined functions
Petter Nyström
jimorie at gmail.com
Thu May 10 10:22:33 CEST 2012
On Thu, May 10, 2012 at 9:23 AM, Kent Mein <mein at cs.umn.edu> wrote:
> Instead of getting an error undefined function call is_waerable, things
> just fail silently. Is this a tunable parameter in dgd or is this something
> we would have to implement at the mud lib level? (seems like it shouldn't
> be at that level)
This is a defining behaviour of the LPC language.
Calling non-accessible functions (be them private, static or
undefined) in other objects will return nil (or 0, depending on your
level of typechecking).
As far as I know, this is not something you can change as a driver
configuration.
Personally, I have learned to appreciate this language quirk --
without it you'll need extra code to either check that the object you
call has the function you expect or code that handles any undefined
method errors.
You could, I suppose, implement this check at the mudlib level via
masking call_others with something like:
mixed call_other(mixed obj, string function, mixed args...)
{
mixed result;
result = ::call_other(obj, function, args...);
if (typeof(result) == T_NIL)
{
if (!function_object(function, obj))
{
error("undefined function " + function + " for " +
object_name(obj));
}
}
return result;
}
Regards,
Jimorie
More information about the DGD
mailing list