Remix.run Logo
mwkaufma a day ago

need to represent the "captured-variables"/closure

Dwedit 18 hours ago | parent [-]

C# does closures by creating a class. When you run the function, captured local variables actually live inside the object instead of in the stack. This makes use of an object, but no memory pages need to become read/write/executable to make C#-style closures happen. You just have a combination function/object pointer (a delegate) instead of a single function pointer.