Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Wait. This is pretty much just "closure conversion," which is a standard, and widely known technique. Did I not read carefully enough?


In the abstract, sure; but what it was doing before was also "closure conversion". The interesting bit is in the specific implementation details.

Closures need the combination of code and data. There are multiple implementation strategies to pair the two together though. Delphi, for example, has implemented method pointers for a very long time as a pair of pointers, one code and one data.

When I added anonymous method support, that wouldn't fly because it doesn't handle account memory management (Delphi is not garbage collected). So I implemented a different form, using COM-style interfaces, where the code pointer is the first method after QI, Addref and Release. Since Delphi had auto-refcounting support for COM pointers, this solved the dynamic closure allocation problem; and since it was language independent, it solved the C++ interop problem.


[deleted]


It would have been nice to use the standard term to describe it, if only to make it easier to find more details elsewhere.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: