[DGD] Code libraries for DGD and Hydra

Felix A. Croes felix at dworkin.nl
Fri Sep 21 17:28:22 CEST 2018


bart at wotf.org wrote:

>[...]
> I'd like the operator overloads you mention, and I can see how those might
> help with the 'clean code' argument, but not with the overhead one, rather,
> LWOs getting copied to the 'local' dataspace once a task finishes when passed
> to another object makes me think it would introduce more overhead.

The subject perhaps deserves to have its own thread, but as the author
of the closures extensions I think I can answer the question about the
cost of implementing them in LPC.  The overhead would be minimal.  The
'function' datatype is, in fact, treated like a kind of LWO.

A precise reimplementation in LPC would require the support of &() and
*() operators.  Upon consideration, I don't want to go so far, and would
prefer changing the syntax to something that DHD/Hydra already supports:

    # define Function    object "/lib/closure"

    func = new Function("function_name", initial_arg);
    func->append(secondary, arguments);
    func->call(extra_argument);

As a way of solving the callback problem, I quite prefer continuations
over closures, though.

Regards,
Felix Croes



More information about the DGD mailing list