3 ms·
I've used a very similar trick for adding partial function application to Forth: https://github.com/JohnEarnest/Mako/blob/master/lib/Algorithms/Curry.fs https:/
by RodgerTheGreat 14y ago
I've used a very similar trick for adding partial function application to Forth: https://github.com/JohnEarnest/Mako/blob/master/lib/Algorithms/Curry.fs https://github.com/JohnEarnest/Mako/blob/master/lib/Algorith...
If I understand correctly, though, your implementation leaks memory. In my case I use a GC to free the thunks when they are no longer accessible.
- mappu 14y agoIndeed, in typical C fashion all the created stubs must be freed manually. Adding a GC is a separate task and several exist for C. Though if you were using C++, you could put together some RAII sugar or smart pointers around it all, but in that case you have std::bind1st and functors available anyway (although this is still the only way to meet the raw-pointer use case).