3 ms·
It’s a pointer to the environment, and a pointer to the function. So yes, not a stack frame pointer. The environment is a struct containing what is captured; s
by steveklabnik 8y ago
It’s a pointer to the environment, and a pointer to the function. So yes, not a stack frame pointer.
The environment is a struct containing what is captured; so for example, it would contain an &T if your closure captures a T by reference. You don’t need to walk a set of stack pointers to find it, just follow the reference directly there.
- WalterBright 8y agoThat's distinctly different from D's, which has a pointer to the enclosing stack frame. If it is the enclosing function, it's just a single pointer to it. The "walking" comes from if you're accessing the enclosing function's enclosing function's frame.
- steveklabnik 8y agoMakes perfect sense, thanks. I’m now wondering about the trade offs of these two approaches...