>> > > 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. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe