Java Closures: programming in closures?
Why closures?
If i get things right the closures project aims to pack multiple statements into one logical program unit. For instance the following line would be a logical programming unit:
{
int x = 3;
int y = 4;
int s => x + y;
}
So in this case you have two ints that you add together and this code works as one logic programming unit. I dont see between this code and this code:
int x = 4;
int y = 3;
int sum = x+y;
System.out.println("x + y " + sum);
And - if someone wants to use a more procedureal way - he can put this into a method as follows:
public int add(int x, int y){
return x+y;
}
However the closures project also offers a closures syntax for methods. Does this mean Java is making a shift to a more procedural programming philosphy? May be i am too far on the surface but i dont see the big benefit of closures right now but may be there is one i did not capture yet.
- Login or register to post comments
- Printer-friendly version
- alexanderschunk's blog
- 648 reads





