Arc Forumnew | comments | leaders | submitlogin
2 points by CatDancer 4150 days ago | link | parent

the hard part is making it work, and making it work without leaving the old definitions behind when the lambda no longer exists

I don't know about the first part, but for the second, what you want is a weak hash table ( with the lambda's stored as the keys. The weak hash table holds the keys "weakly", which means it doesn't prevent the keys (the lambda's) from being garbage collected, and when they are garbage collected, the related value is dropped from the table.