3 ms·
> I’m not sure whether you mean semantically or in implementation I'll have to mull over that. I guess to me they seem aligned enough, thats why it feels so el
by kjeetgill 4y ago
> I’m not sure whether you mean semantically or in implementation
I'll have to mull over that. I guess to me they seem aligned enough, thats why it feels so elegant. Or maybe I haven't thought about it enough.
> rather compiled as static functions and an invokedynamic instruction that will resolve to them at first occurrence
Yea! but that invokedynamic calls the lambda metafactory which spins up bytecode for a class with 2 things: a) a constructor to bind the values captured from the scope the lambda was declared in to fields, and b) an instance method that feeds those fields to the static function you referred to.
I'd argue that that class is essentially an anonymous class. Maybe I'm easily impressed, but that functional programming <-> OOP duality of lambdas/closures and SAM interfaces always felt profound.
We can get along! There's no need for this feud!
- kaba0 4y agoI just wanted to add something I knew on the topic, but you seem to know much more! Thanks for the interesting read, and it is indeed a cool duality!