neal at gafter.com
Mon Aug 15 15:16:00 PDT 2011
On Mon, Aug 15, 2011 at 2:58 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> That's absolutely true. But the bar is not, and should not be, "we
> should add a language feature if there is some model in which that
> feature makes sense." The ability to point to examples where it would
> be safe or sensible is a necessary, but not remotely sufficient,
> condition to justify inclusion of a language feature.
> The choice to exclude mutable local capture was not an oversight, but
> the result of a reasoned tradeoff which includes cases like those you
> allude to.
"mutable local capture" is not a language feature. Locals variables are a
feature. Variable mutation (assignment) is a feature. Lambdas (closures)
are a feature.
The choice not to "add mutable local capture" was not a choice "not to add"
a language feature, because "mutable local capture" isn't a language
feature, it is the intersection of otherwise orthogonal language features.
The choice to exclude mutable local capture was a decision to design Java's
language features in a non-orthogonal way, by considering and defining the
interactions of individual features on a case-by-case basis by reference to
use cases and their perceived importance. That's not always the best way to
design a programming language.
More information about the lambda-dev