www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Function in a slice instead of just pointer?

reply Michael Brown <mikey.be gmail.com> writes:
Hi D Community,

Is it possible to get a slice of a function, rather than just its 
start pointer?

I'm interested in currying a function at runtime - So I would 
need to copy a function block (Either the original function, a 
wrapper function, or copys of manually altered functions).

Addresses of labels would also be useful - Does Dlang have 
computable labels? (&&lbl in C)

I suspect Ill have to do this in ASM, but seeing if there's a 
higher level solution?

Kind Regards,
Mike Brown
Jun 21 2018
parent Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Thursday, 21 June 2018 at 21:00:46 UTC, Michael Brown wrote:
 Hi D Community,

 Is it possible to get a slice of a function, rather than just 
 its start pointer?
No.
 I'm interested in currying a function at runtime - So I would 
 need to copy a function block (Either the original function, a 
 wrapper function, or copys of manually altered functions).
see https://dlang.org/phobos/std_functional.html#partial
 Addresses of labels would also be useful - Does Dlang have 
 computable labels? (&&lbl in C)
Don't think so.
 I suspect Ill have to do this in ASM, but seeing if there's a 
 higher level solution?

 Kind Regards,
 Mike Brown
Jun 21 2018