PDA

View Full Version : Pointers to functions in other languages



sean
06-25-2003, 08:14 PM
Aside from C/C++, what other languages have pointers to functions (preferably web programming languages like Perl, PHP, Java/Script, etc...)? If they don't, is there any other way I can easily store a reference to them in something like an array?

Zach L.
06-25-2003, 09:01 PM
Don't think many languages support pointers the way C++ does. You can have references to subroutines in Perl though:



sub f
{
...
}

$ref = *f{CODE};
&$ref; # calls f

# or anonymous subroutines

$ref = sub { ... };
&$ref;