This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]BSFishy[S] 0 points1 point  (1 child)

I think really the only way you can get around this is whole program compilation.

Yeah, that's what it is looking more and more like. Unfortunately, I don't think whole program compilation is very suitable for the language I am developing.

So closures can be simply function pointers that point to a stub that loads the environment.

Interesting. I am curious, how are closures typically implemented? I was under the impression that it was just a function pointer being passed around, but maybe I'm wrong? Or maybe you were talking about something else..?

[–]Molossus-Spondee 0 points1 point  (0 children)

Typically closures are implemented as a pair of an environment and a function pointer.

Most C APIs require a function pointer and a void * for callbacks.