Pointers to functions in other languages

This is a discussion on Pointers to functions in other languages within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Aside from C/C++, what other languages have pointers to functions (preferably web programming languages like Perl, PHP, Java/Script, etc...)? If ...

  1. #1
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913

    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, 11: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, 01:28 AM
  4. pointers, functions, parameters
    By sballew in forum C Programming
    Replies: 3
    Last Post: 11-11-2001, 10:33 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21