Closures in JDK7 ?

A very clear and concise post by Neal Gafter on the use , differences and benifits of closures here.
When I read the initial proposal , it was slightly confusing.
I felt that the return syntax smelt like goto's , ability to access non-final local variables was worrisome , etc.
The ideas on the last two posts (here and here) are very instructive and clarify things quite a bit.
The synchronous usecase is something I have tried time and again to solve within my code - usually inefficiently with hacked up callbacks : closures would be a much more cleaner fix for this problem.

Comments:

Goto indeed! See the famous "Lambda: The Ultimate GOTO," but Guy Steele (who, incidentally, is at Sun nowadays). Google it! A lot of people would take your comment as a compliment of closures, not as a dis.

Posted by Nico on September 05, 2006 at 02:12 PM IST #

An obscure reference: "plus ├ža change..."

Posted by Nico on September 05, 2006 at 02:22 PM IST #

Hi Nico, Thanks for that great paper (and related ones from one of those sites). I went through the "Lambda: The Ultimate GOTO" and if I am not wrong , isn't it not selling proc calls over goto ? I am not doubting the power and expressiveness of goto if used well (just like I dont doubt the efficieny and power of assembly) - but it does lead to sphagetti code when used by most people. Programmers who can use it well , do - but introducing goto (or similar) as the preferred programming construct for a new idiom might be a step backwards right ? Ofcourse , it might just have been that I misinterpreted the intent:-) Mridul

Posted by Mridul on September 05, 2006 at 03:31 PM IST #

The topic is long, and a conversation over blog comments isn't going to cut it, but basically given closures you can create amazing flow control operators, including things like catch/throw, all the loops you see in traditional Algol-family languages, Prolog-like (or Icon!) backtracking (think regular expressions) and more. I highly recommend these books if you're interested: "LISP In Small Pieces" (get it? it's recursive) by Christian Queinnec, and "On Lisp" and "ANSI Common Lisp," both by Paul Graham. On Lisp is out of print, but you can download it and Graham's other books from Graham's web site.

Posted by Nico on September 05, 2006 at 06:47 PM IST #

The topic is long, and a conversation over blog comments isn't going to cut it, but basically given closures you can create amazing flow control operators, including things like catch/throw, all the loops you see in traditional Algol-family languages, Prolog-like (or Icon!) backtracking (think regular expressions) and more. I highly recommend these books if you're interested: "LISP In Small Pieces" (get it? it's recursive) by Christian Queinnec, and "On Lisp" and "ANSI Common Lisp," both by Paul Graham. On Lisp is out of print, but you can download it and Graham's other books from Graham's web site.

Posted by Nico on September 05, 2006 at 06:58 PM IST #

this is a long and narrawed topic and is about closure that can creat some things

Posted by mike on May 24, 2007 at 08:45 AM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

mridul

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Bookmarks
Blogroll

No bookmarks in folder