Thread: Pointers to functions in other languages

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912

    Pointers to functions in other languages

    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?

  2. #2
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Don't think many languages support pointers the way C++ does. You can have references to subroutines in Perl though:

    Code:
    sub f
    {
    ...
    }
    
    $ref = *f{CODE};
    &$ref; # calls f
    
    # or anonymous subroutines
    
    $ref = sub { ... };
    &$ref;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Conversion of pointers to functions
    By hzmonte in forum C Programming
    Replies: 0
    Last Post: 01-20-2009, 01:56 AM
  2. HELP WITH FUNCTIONS and POINTERS!!!
    By cjohnson412 in forum C++ Programming
    Replies: 4
    Last Post: 08-11-2008, 10:48 PM
  3. Some help with class member functions and pointers
    By k_rock923 in forum C++ Programming
    Replies: 1
    Last Post: 07-21-2005, 12:28 AM
  4. pointers, functions, parameters
    By sballew in forum C Programming
    Replies: 3
    Last Post: 11-11-2001, 10:33 PM