[DGD] function pointers

Felix A. Croes felix at dworkin.nl
Tue Jun 21 02:41:01 CEST 2011


I've created a new branch in my personal git repository on sourceforge,

    git://dgd-osr.git.sourceforge.net/gitroot/dgd-osr/dworkin

named 'functionp', which contains a minimal implementation of
function pointers.  This is for DGD only and has not yet been merged
into the master branch.

Changes:

 - new 'function' datatype
 - &func() creates a pointer to the function 'func'.  Arguments may
   be included here, with which the function will be invoked.
 - (*functionp)() calls the function.  The function will be called with
   the arguments specified when the function pointer was created,
   followed by the arguments specified in the call.

    function f;

    f = &foo(1, 2);
    (*f)(3);		/* foo(1, 2, 3) */

Function pointers work just like call_other(), except that they can also
be used to call static functions.

Regards,
Felix Croes



More information about the DGD mailing list