why unrestricted closures are always void?

Neal Gafter neal at gafter.com
Sat Nov 15 13:26:08 PST 2008


Unrestricted closures are not so constrained: they can have any return type.

On Fri, Nov 14, 2008 at 6:25 PM, Vladimir Kirichenko <
vladimir.kirichenko at gmail.com> wrote:

> This makes impossible to implement functional-style control abstractions
> like generators:
>
> Iterable<Integer> squares = yield(int i : someIterable()) { i * i }
>
> int[] sqa =  for collect(int i : array) { i * i }
>
> It looks very inconsistent to be able to use control abstraction with
> "void" code and to be unable to use it with "code with result".  It places
> major limitation to usage of control abstractions. Is this really necessary?
>
> --
> Best Regards,
> Vladimir Kirichenko
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20081115/cd8d719b/attachment.html 


More information about the closures-dev mailing list