Lambdas and instantiation

Neal Gafter neal at gafter.com
Thu Jan 28 21:21:43 PST 2010


On Thu, Jan 28, 2010 at 5:45 PM, Alex Blewitt <alex.blewitt at gmail.com> wrote:
> I think it would be good to define in what circumstances a lambda can
> result in a new instance created under the covers. If we don't mention
> anything in the spec, then developers may (incorrectly) assume that no
> instance-binding operator takes place. For example, JLS3 15.6 defines
> "Normal and Abrupt Completion of Evaluation"
>
> http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.6
>
> "A class instance creation expression (§15.9), array creation
> expression (§15.10), or string concatenation operator expression
> (§15.18.1) throws an OutOfMemoryError if there is insufficient memory
> available"
>
> This can be seen to hold for lambda instantiation as well, though not
> necessarily all the time. Consider:

Permitting OOME and requiring it are two different things.  When the
spec permits OOME, the implementation is allowed (but not required) to
allocate memory.  So we might as well just say that OOME is permitted
on evaluating a lambda expression.


More information about the lambda-dev mailing list