[Haskell-cafe] How to fulfill the "code-reuse" destiny of OOP?

Martin Coxall pseudo.meta at me.com
Wed Jan 13 18:53:59 EST 2010


>> 
> 
> Anonymous classes in Java close over their lexical environment (can
> refer to variables in that lexical environment, with values bound at
> the time of instance construction) with the caveat that only local
> variables/parameters marked as 'final' may be referred to.  Aside from
> the horrible syntax, this is the key distinction between them, and,
> say, Ruby closures.  Referring to mutable variables from inside a
> closure has its drawbacks, making the horrible syntax the biggest
> stumbling block to using them IMHO (other than runtime overhead, which
> I believe is also an issue).


Yes, this. Which makes them basically unusable where you might want proper closures.


More information about the Haskell-Cafe mailing list