3 ms·
How do D’s nested procedures differ from the Obj-C block extension? The original pascal based Mac toolbox APIs encouraged nested procedures in modal contexts -
by salgernon 6y ago
How do D’s nested procedures differ from the Obj-C block extension?
The original pascal based Mac toolbox APIs encouraged nested procedures in modal contexts - but Nested procedures couldn’t escape their outer frame.
- WalterBright 6y agoI have no idea what Obj-C block extensions are. D's nested functions (like Pascal's) have two frame pointers - a dynamic frame pointer (like C has), pointing to the caller's stack frame, and a static frame pointer pointing to the enclosing function's stack frame. This allows the nested function to access the enclosing function's variables. It's a bit tricky to set up, but works a treat.