unrestricted closures

Vladimir Kirichenko vladimir.kirichenko at gmail.com
Sun Nov 16 14:44:07 PST 2008


Neal Gafter wrote:
> All of the examples I've seen where you could get into this kind of 
> "trouble" involve making locally obvious errors.  The exception points 
> you precisely to where you made the mistake, too.  In this case the 
> temp() method clearly constructs a closure that should not escape its 
> scope (it has a return in it) yet is assigned to a static variable.

The main point was to show that after the

unrestrictedClosure.invoke()

there are to guaranty that the following statements will execute.

so there will be no exception but the code will not be executed:

void m ({int ===> void} t) {

       t.invoke(i);

       System.out.println("who knows if we ever get here...");

    }

Doesn't it look strange?

-- 
Best Regards,
Vladimir Kirichenko

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20081117/c3dda7f4/attachment.bin 


More information about the closures-dev mailing list