Subj : Re: anyone know of a language where nonexistent functions return To : comp.programming From : Jonathan Bartlett Date : Fri Jul 22 2005 12:01 pm pantagruel wrote: > An existent function calling such a nonexistent function would > basically be left with an empty string, unless the programmer defined > specific error generation. Theoretical literature welcome. hope this is > a reasonable question to ask here > Perl can do this and more (it can actually dynamically generate the given function at runtime). If you define AUTOLOAD, it will be called for non-existant functions in the current package. So if you have a program like this: sub AUTOLOAD { return ""; } $test = foo(); This does what you want. Even better, you can have stuff like this (adapted from the Perl documentation): sub AUTOLOAD { my $name = our $AUTOLOAD; *$AUTOLOAD = sub { return "You were calling $name\n"; } goto &$AUTOLOAD; } $a = foo(); #$a now has "You were calling foo\n" $b = eee(); #$b now has "You were calling eee\n" $c = foo(); #same as above, but now that foo() is loaded, it doesn't call autoload any more Jon ---- Learn to program using Linux assembly language http://www.cafeshops.com/bartlettpublish.8640017 .