Friday, December 28, 2007

Java Closures Tutorial

Java Closures Tutorial

JSR Proposal: Closures for Java, section 2:

'This JSR provides support for operating on an arbitrary "block of Java code", or body, which is either a statement list, an expression, or a combination of both. We call the mechanism a closure expression. Wrapping statements or an expression in a closure expression does not change their meaning, but merely defers their execution. Evaluating a closure expression produces a closure object. The closure object can later be invoked, which results in execution of the body, yielding the value of the expression (if one was present) to the invoker. A closure expression can have parameters, which act as variables whose scope is the body. In this case the invoker of the closure object must provide compatible arguments, which become the values for the parameters.'

This tutorial does not describe the whole proposal but only the features implemented in the prototype compiler. All examples in this tutorial were tested against the early prototype available at http://www.javac.info. Current version: closures.tar.gz

99 comments:

danrevel said...

How do I build and test against the closure prototype code?

Hamlet D'Arcy said...

As long as you have Java 6 in your path (you'll need to execute java and javac from the command line), then you can unzip the files and move to the bin folder within there, and then call java.bat and javac.bat to use the prototype.

It would be great if the .ztar file could contain an example, but I got it all working so it's not a big issue for me.

Anonymous said...

Java boys, time to learn Lisp!

Anonymous User said...

As far as the Closure Syntax have you thought of alternatives to "=>" ?

I've always like how "::" looks if nothing else, and C++ confusions aside, if I saw "::" in a Java program I wonder what it was doing there. "=>" would surely be read as a boolean operation by the uninformed.

Zdeněk Troníček said...

There are several alternatives to "=>". My personal preference is "->" but "::" is not bad too.

beltorak said...

I have worked for the last day over an alternate syntax - is it too late to fundamentally change the syntax? My intent is to provide a syntax that is more or less consistent with the rest of the Java language, making it more easily intuitable; I abhor the '=>' - mainly because it is hard for me to type that sequence in rapid succession, but also because it makes Java feel less... Java-y. I like using '#' as a closure signifier (much like '@' is used as the annotation signifier) as in the method references, but with closure declarations and definitions bounded by '#{' and '}'.

My text file of examples and comments is about 700 lines so I posted it on pastebin. It may not be entirely internally consistent as some of the ideas I was working out as I wrote it.

Please let me know, even if it's a "sorry, we've settled on the arrows".

Thanks

Zdeněk Troníček said...

Hi beltorak,

as far as I know, it is not late because the closures proposal have not been approved yet.

Anonymous said...

Can i use this into a IDE, as NetBeans?

Kartik said...

Nice one to understand closures

Marc Azada said...

This tutorial was really a big help to me. Thanks! Great post! Installing something new which is great is really nice.

Macuz said...

Thanks for tutorial.

MedifastHealth.org said...

Thanks for sharing helpful information, I really like your all post. I will bookmark your blog for future updates.

MedifastHealth.org said...

Really like your blog content the way you put up the things...I've read the topic with great interest and definitely will stick your blog routinely for other great posts.MedifastHealth.org

Arindom Chanda said...

Java is really huge language.Whatever you want you will find.But learning Java is really a tough task.I tried once.
Carbon fiber hoods

Khanh Tran said...

I have got many useful information about Java Closures from this blog. Definitely this blog will be a very helpful to the people. Keep providing more information.
ab machines

brooke Ef said...

would it be weird to offer a job here? i don't speak computer, but I recruit for it. brooke@accruepartners.com

dissertation proposal help said...

I am very thankful to you for posting such stuff.This really help me lot.
mba dissertation | mba dissertation writing | mba dissertation proposal

dissertation proposal said...

I did not expect this. This is a excellent story. Thanks! You completed a few nice points there. buy dissertation proposal | Finance Dissertation Writing

Facebook Game Developer said...

Well this is really a informative post and I am glad to read such a great post. I came to your site by mistake but from now I am going to read all of your posts. Great article thanks

iPhone Application Developer said...

After read blog topic's related post now I feel my research is almost completed. happy to see that.Thanks to share this brilliant matter.

Abella Ivan said...

Awsome blog! I will for sure drop by it more often!

Buy Term Papers

Essay Writing Services said...

Good stuff. It is interesting to read comments.Essay Writing services

david Rice said...

The way you shared your knowledge here is amazing..

Dissertation Editing Services

Online Shopping in Karachi said...

I have found this blog very exciting. Do you have any others on this topic? I am also sending it to my friend to enjoy your writing style. Thanks for sharing.
Online Shopping in Karachi

Jannatul Ferdus said...

I am very enjoyed for this side. Its a nice topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy. I think it may be help all of you. Thanks.Read more

Best Essay Writer Service said...

Thanks you so much. This post is very help full for me a lot. Thanks for sharing nice post

harga samsung galaxy ace 2 said...

As long as you have Java 6 in your path (you'll need to execute java and javac from the command line), then you can unzip the files and move to the bin folder within there, and then call java.bat and javac.bat to use the prototype. harga samsung galaxy note 3

Divya said...

Is there any other way to get answer like this? I tried with out success. Any way thanks for your help.
I learned a lot from Besant Technologies in my college days. They are the Best Java Training Institute in Chennai

harga samsung galaxy young said...

thank you..Is Good.

Tom Brian said...

I love it your ideas are great. Nice one good job..
Airport Taxi

Tina brian said...

Awesome post this one realy helped me at my point of confusion :) Realy thanx alot for sharing :) Keep it up ;)
Billy Bishop Airport
YTZ Airport
Taxi to Billy Bishop Airport

Vetri Vel said...


Good stuff. It is interesting to read comment


Essay writing services

get rid of cellulite said...

There are so many different aspects when it comes to this topic. Thank you so much for sharing your knowledge on this particular aspect.
silicone bh

karthick besant said...

good one...i am very very interesting



Oracle Training in Chennai

toko alat bantu sex said...

thank you friends that you make this information very interesting and made me curious to see her. Greetings by alat bantu sex

http://goo.gl/ViHqee
http://t.co/5qVBuIqQVf
http://goo.gl/TJkk8V
http://goo.gl/2FYU45
http://goo.gl/rRf1Ly
http://goo.gl/NhWoCP
http://goo.gl/3uzzBC
http://goo.gl/pVrPFe

alat sex wanita said...

info khusus untuk pria wanita dewasa, kami jual alat bantu sex mnyediakan berbagai macam penis silikon, penis palsu ini merupakan peralatan yang dapat di gunakan kaum wanita untuk di jadikan alat pelampiasan hasrat seksual. selain penis mainan sex wanita kami juga juga jual vagina silikon yang dapat di pakai pria untuk onani / masturbasi.

pembesar penis said...

nice post.

Fabian Smith said...

The look of this blog is very attractive and outstanding, I really liked it and appreciate this amazing work of art in this blog. Hamilton Resourcing
Human Resource Solutions UAE
Psychometrics Tests
Psychometrics Test Dubai
Talent Management
Integrity International
Executive Recruitment UAE
The McQuaig Psychometric System
The McQuaig Job Survey
The McQuaig Word Survey
The McQuaig Self-Development Survey
Executive Search Firms in Dubai
Head Hunters Dubai
Executive Recruitment in Dubai
Emirati Talent Management
Executive Headhunters Dubai
Executive Recruitment Dubai
Executive Search Dubai

get rid of cellulite said...

I have visited this blog first time and i got a lot of informative data from here which is quiet helpful for me indeed.
aanrechtblad

website laten maken said...

I found this post very exciting. I think you will have any other post on this topic? I am also sending it to my friend to enjoy your working style. Cheers!

rebeka christy said...

I get a lot of great information from this blog. Recently I did oracle certification course at a leading academy. If you are looking for best Oracle Course in Chennai visit FITA IT training and placement academy which offer SQL Training in Chennai.

mehroz aftab said...

This is very nice one and gives indepth information. thanks for this nice article.
terrazzo keukenblad

rahfy said...

Hi, Nice work, I've bookmarked this page and have a feeling I'll be returning to it regularly.
dekton keukenwerkblad

Emi Jackson said...

Your blog is really useful for me. If anyone want to become an oracle certified professional reach FITA, which offers best Oracle Training in Chennai with years of experienced professionals. For more details about oracle, sql training visit this site.

Oracle Training in Chennai

Martina Christy said...



Thanks for sharing this informative blog. FITA provides Salesforce Course in Chennai with years of experienced professionals and fully hands-on classes. Salesforce is a cloud based CRM software. Today's most of the IT industry use this software for customer relationship management. To know more details about salesforce reach FITA Academy. Rated as No.1 Salesforce Training Institutes in Chennai.

Emi Jackson said...

SAP Training Institute in Chennai

Thanks for sharing this valuable information.and I gathered some information from this blog. I did SAP Training in Chennai, at FITA Academy which offer best SAP Course in Chennai with years of experienced professionals.

SAP Institutes in Chennai

Toko Jual Obat Kuat Alat Bantu Sex 087733776655 said...

Klik Aja Di Bawah Ini
Pemesanan: 087733776655
http://obatkuat-57.com/
Jual Obat Pembesar Penis Vigrx Plus
Alat Bantu Sex Pria Dan Wanita
Rajanya Obat Kuat Sex
Obat Perangsang Wanita, Obat Gairah Wanita
Obat Pembesar Payudara Monyok, Payudara Kencang
Alat Pembesar Payudara Montok
Alat Pembesar Penis
Alat Sex Pria Boneka Moderen
Obat Pengental Sperma
Minyak Pembesar Penis, Obat Pemanjang Penis
Obat Hernia Paling Ampuh
Obat Pelangsing Badan, Melangsingkan Tubuh
Obat Perapet Vagina
Obat Peninggi Badan, Meninggikan Bada
Obat Pembesar Pantat, Pembesar Bokong
Obat Pemerah Bibir, Pemerah Puting
Obat Pemutih Wajah Alami Tensung Cream
Obat Penggemuk Badan
Obat Penghilang Tatto Permanen Herbal Alami
Kondom Antik Pria
Rajanya Obat Kuat Pria
Alat Bantu Sex Wanita Antik
Alat Bantu Sex Pria
Obat Kuat Herbal
Vimax Obat Pembesar Alat Vital
Cara Memutihkan Selangkangan dan Ketiak


Obat Pelangsing Badan Fatloss Jimpness Beauty
Selaput Dara Perawan Buatan


christina jeni said...


The information you posted here is useful to make my career better keep updates...If anyone want to get Cloud Training in Chennai, Please visit FITA academy located at Chennai. Rated as No.1 Cloud Computing Training Centers in Chennai

christina jeni said...


The information you posted here is useful to make my career better keep updates...If anyone want to get Cloud Training in Chennai, Please visit FITA academy located at Chennai. Rated as No.1 Cloud Computing Training Centers in Chennai

christina jeni said...

I have read your blog and i got a very useful and knowledgeable information from your blog.You have done a great job . If anyone want to get Salesforce Developer Training in Chennai, Please visit FITA academy located at Chennai Velachery. Rated as No.1 Salesforce Training Institutes in Chennai.

Workers Compensation said...

Excellent blog, lots of useful info. happens all the time.
Pain Treatments
Botox Injections
Discography
Epidural Injections
Epidural Lysis Procedure
Facet Blocks
Intercostal Nerve Blocks
Intrathecal Pump Therapy
Intradiscal Electrothermal Therapy
Intercostal Nerve Blocks
Joint Injections
Platelet Rich Plasma
Percutaneous Discectomy
P-STIM
Racz Epidural Neurolysis
Radiofrequency Lesioning
Selective Nerve Root Blocks
Spinal Cord Stimulation
Sympathetic Nerve Blocks
Vertebroplasty
Pain Locations
Arm Pain
Abdominal Pain
Back Pain
Cancer Pain
Chest Wall Pain
Disc Herniation

toko online said...

Thanks for sharing!

Jual Obat Tidur Cair - Obat Bius Herbal
Obat tidur Cair ~ Bridal Red Drop ~ Obat Tidur Herbal
Obat Bius Permen Karet ~ Obat Bius Paten
Obat Bius Chlorophyll ~ Obat Bius Semprot
Obat Tidur Kapsul ~ Obat Tidur Mujarab
leeping Beauty ~ Obat Tidur Cair Paten
Serbuk Tian ~ Powder Germany ~ Obat Bius Manjur
Obat Bius Cair ~ Liquid Sex ~ Obat Bius Ampuh

toko online said...

Thanks for sharing!

Jual Obat Kuat, Alat bantu sex, Obat perangsang wanita
Potenzol Cair, Obat Perangsang Wanita
Penis Mutiara Maju Mundur ~ Alat Bantu Seks Wanita Terpopuler
Alat Bantu Sex Wanita ~ Penis Ikat Pinggang ~ Alat Bantu Terpopuler
Vimax Piils, Obat Pembesar Penis
Viagra Usa 100mg, Obat Kuat




Jual Obat Kuat, Alat bantu sex, Obat perangsang wanita
Alat Bantu Sex Wanita ~ Penis Ikat Pinggang ~ Alat Bantu Terpopuler
Penis Mutiara Maju Mundur ~ Alat Bantu Seks Wanita Terpopuler

murali karthik said...

Thanks for sharing this information. Java is one of the popular object oriented programming language used for many of the multinational corporation. So learning Java Training in Chennai is really helpful to make a bright future.

toko online said...


Thank you for the information by reading this article I know a lot of things and we also develop ya can also visit us at

Jual Obat Kuat, Alat bantu sex
jual obat bius, jual obat tidur
jual obat bius tokcer
jual obat tidur tokcer



Max Petter said...

Awesome Post!
CAA Hotels in Saskatoon
Executive Suites in Saskatoon
Long Term Suites in Saskatoon
Saskatoon Hotel
Hotels in Saskatoon
Saskatoon Hotels
Cheap Hotels in Saskatoon

Max Petter said...

Your site is so informative!
Visitor labels DYMO
Direct Thermal Visitor Passes
Visitor Passes for Direct Thermal Printers
Badges for PassagePoint Software
Self-expiring adhesive badge labels
Non Adhesive Visitor Badges
dymo labels

The Rage Mafia said...

Great
Veterinary Medication Labels
Rexam Vials
oral med dispensing
Feline EZ Soft Collar
Dymo 3x2 Labels

Maya Angelou said...

useful info
Hijama Training Course
Hijama Courses London
Hijama Courses Institute
Cupping Therapy
Hijama Therapy Diploma

Maya Angelou said...

great wording
Movers In Dubai
Professional Movers Dubai
Moving and Storage
Movers And Packers
Relocation in dubai
Mover companies in dubai

Jessica Amy said...

Thanks for sharing!
Niagara Falls Airport Taxi
Richmond Hill Airport Taxi
Markham Airport Taxi
Vaughan Airport Taxi
Pickering Airport Taxi

The Rage Mafia said...

Thanks For Sharing...
download wordpress themes 2015
free premium wordpress themes
Premium Blogger Templates 2015
premium wordpress themes free download

Haresh Vaswani said...

Thank you for this info, this is something I've been seeking for quite a bit.
Vaswani nigeria
Vaswani platinum
Vaswani stallion

Haresh Vaswani said...

This is just gorgeous! How amazing!
Master of Science in Information Assurance
Certificate in Advanced Culinary Arts
Associate of Applied Science in Baking and Pastry Arts
Bachelor of Arts in Hospitality Management

Haresh Vaswani said...

It’s going to be ending of mine day, but before ending I am reading this fantastic piece of writing to improve my knowledge..
dubai desert safari rates
cheap desert safari dubai
desert safari uae
dubai desert safari with bbq dinner

Anonymous said...

nice post korada provides telugu political news and telugu movie news accurately. You can get genuine telugu political, cinema news current affairs, andhra news, telangana news and all latest news @ korada.com

rehan said...

It’s going to be ending of mine day, but before ending I am reading this fantastic piece of writing to improve my knowledge.
Godaddy Coupon Code
Hostgator Coupon Code
Volcom Coupon Code

Dinesh Jaganathan said...

I have read your blog and i got a very useful and knowledgeable information from your blog.its really a very nice article.You have done a great job . If anyone want to get Best Pega training institutes in Chennai, Please visit Greens Technologies located at Chennai Adyar which offer Best Pega Training in Chennai.Your information about scripts is really interesting. Also I want to know the latest new techniques which are implemented in Pega. Can you please update it in your website? Pega Training

Dinesh Jaganathan said...

I have read your blog and i got a very useful and knowledgeable information from your blog.its really a very nice article.You have done a great job . If anyone want to get Best Oracle training institutes in Chennai, Please visit Greens Technologies located at Chennai Adyar which offer Best Oracle Training in Chennai.

obat tidur said...

thanks for the article information is very useful for me

a>

Alita Duplanty said...

expressrubberflooring.co.uk holds the quality stock of Rubber Flooring Tiles amongst the other suppliers and sellers in the UK. The flooring is available in the great patterns and eye catching designs.Call Now 01744 520 110

Sonya P. Ortega said...

UK Ireland Student Visa
UKVI (United Kingdom Border Agency) approved English language test Center in Pakistan. UKVI English test Center Pakistan.

Sonya P. Ortega said...

Low bed Trailer Rental
AAA Cranes is a leading Low bed trailer rental company in Jizan Turaif and other cities of Saudi Arabia KSA and Gulf as well Call for more detail +966 563446767.

Sonya P. Ortega said...

Water Filtration Disinfection
Find the best Water Filtration Disinfection system installation and management in Pakistan Saudi Arabia UAE Gulf under supervision of highly skilled engineers and consultants.

Anonymous said...

korada provides telugu political news and telugu movie news accurately. You can get genuine telugu political, cinema news current affairs, andhra news, telangana news and all latest news @ korada.com

Sandhya Reddy said...

Recruitment voice provides recruitment, latest jobs, jobs in India, Job Requirement, Government Jobs, Banking News, and GK Updates, current @ recruitmentvoice.com.

Naresh said...

Great Post.
First Telugu contains telugu political news, latest news in telugu, telugu film news, Tollywood news, ap news, telangana news, movie trailers and movie reviews.

Anonymous said...

Nice Post.
telugu town contains telugu political news, latest news in telugu, telugu cinema news, Tollywood news, ap news, telangana news, movie trailers and movie reviews.

Alat Bantu Sex Pria said...

are very helpful for those who do not know highly qualified and all his articles bagi pria yang ingin menambah ukuran alat vital pria dengan obat pembesar penis,salah produk obat pembesar penis yang sangat ampuh yaitu neosize xl untuk proses lebih cepat dan maksimal cukup baik menggunakan
alat pembesar penis

dan tidak lupa buat wanita yang masih jomblo bisa menggunakan
Alat Bantu Sex Wanita

dan yang special buat pria menggunakan
alat bantu sex pria

Savitha said...

Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
Oracle Training In Chennai

Diya Patel said...

Best Java Training Institute In ChennaiThis information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic..

kiran kumar said...

I have read your blog and I got very useful and knowledgeable information from your blog. It’s really a very nice article Spring training In Chennai

kiran kumar said...

I have read your blog and I got very useful and knowledgeable information from your blog. It’s really a very nice article Spring training In Chennai

Diya Patel said...

Best SQL Query Tuning Training Center In Chennai This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic..

Chinthala Keerthi said...

Nice Post.
indiaregisters provides web hosting, domain registration in india,domain registration, domain registration in hyderabad.

Sapna Chowdary said...

Nice Post.
indiaregisters provides web hosting, domain registration in india,domain registration, domain registration in hyderabad.

SAPNA said...


Nice Post.
indiaregisters provides web hosting, domain registration in india,domain registration, domain registration in hyderabad.

Anonymous said...

Nice Information
one and only affiliate agency in south INDIA, earn money online from affiliate network in india

Cite Menu said...

Nice post thanx for sharing. Keep up the good work.

Shaista Lodhi said...

I really appreciate the efforts you put into reviewing these useful resources.

--------------------------
Also checkout our Happy New Year 2017 Shayari new collections.

Rabya Atif said...

I read blog thoroughly; it’s quite informative and well written post. You covered the topic very well. Thanks for sharing.
Also checkout Pakistani chat rooms

Douglas Coffey said...

Great!!!Now a days java is the most useful software for present and future...Some sort of Translation company delivers different kinds of translation which include technological, fiscal, authorized etcetera.

Deepika Kapoor said...

Goa Fashion Service is very choosy about our Goa call girls selection as we have to provide best in class service to our clients .

Anonymous said...


Nice Information

New Year 2017 - New Year 2017 Images Happy New year Wishes 2017, Happy New Year 2017, New Year Wishes, New Year Greetings

fredrick said...

I really like your post due to the outstanding material that you have shared with us through content of the post. plumbing expert in miami

mageswari j said...

Very Nice Blog I like the way you explained these things.
Indias Fastest Local Search Engine
CALL360
Indias Leading Local Business Directory

mageswari j said...

ladies hostel near omrGreen Women hostel is one of the leading Ladies hostel in Adyar and we serving an excellent service to Staying people, We create a home atmosphere, it is the best place for Working WomenOur hostel Surrounded around bus depot, hospital, atm, bank, medical Shop & 24 hours Security Facility

mageswari j said...

brilliant article that I was searching for. Helps me a lot
call360 is Fastest local search Engine we have 12 years of experience in online industery, in our Search Engine we offer,
more than 220 categories and 1 Million Business Listing most frequently search categories
are Money exchange Chennai and Bike mechanic Chennai,
we deliver 100% accure data to users & 100% Verified leads to our
registered business vendors and our most popular categories are
AC mechanic chennai,
Advertising agencies chennai
catering services chennai

mageswari j said...

brilliant article that I was searching for. Helps me a lot.
We are one of the Finest ladies hostel near OMR and our
womens hostel in adyar is secure place for working womens
we provide home based food with hi quality, our hostel located very near to Adyar bus depot.
womens hostel near Adyar bus depot, we are one of the best and experienced
womens hostel near omr