[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bindings and assignments (was: Re: continuations)



On Thu, 14 Aug 2003, David B. Tucker wrote:

> > I imagine, though I don't have statistical evidence, that the
> > requirement of declaring local variables to be final in order to
> > reference them within anonymous inner classes (closures) is almost
> > entirely unknown and unused in practice.
>
> Out of curiosity, does anyone know why Java only allows final variables
> to be referenced from within anonymous classes?

[wild guess]
That way non-objects can be implemented by just copying the value
(since it won't change) and similarly objects can be implemented by just
copying the address.

Rockwalrus