[DGD] function pointers
Felix A. Croes
felix at dworkin.nl
Tue Jun 21 12:21:46 CEST 2011
=?ISO-8859-1?Q?Petter_Nystr=F6m?= <jimorie at gmail.com> wrote:
> Cool.
>
> On Tue, Jun 21, 2011 at 2:41 AM, Felix A. Croes <felix at dworkin.nl> wrote:
> > This is for DGD only and has not yet been merged into the master branch.
>
> But you mean to make this a standard feature of your master branch, eventually?
Function pointers do not belong in LPC. I will never implement them in
Hydra, and if I do decide to merge the functionp branch into the master
branch, it will be an optional feature, not a standard one.
I wrote this to see what the FluffOS crowd would do with it.
> > - (*functionp)() calls the function.
>
> What's the reason for the (*functionp)() syntax? The plain and simple
> functionp() would seem natural to me, but then I'm probably missing
> something. I suppose you don't want to clash with the namespace of
> real functions, maybe...
Functions and variables have different nametables, and the following
is possible:
int foo() { return 1; }
function foo;
I settled on the (*funcptr)() syntax because that's what FluffOS uses.
> Also, in what object will the function be called?
In the object in which the function pointer was bound. If that object
no longer exists, an error results when the function is called.
Regards,
Felix Croes
More information about the DGD
mailing list