Closure capture loop variables

Ali Çehreli via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 30 07:00:41 PDT 2015


On 04/30/2015 05:55 AM, Vladimir Panteleev wrote:

 > D closures should work in the same way as, e.g., JS closures. Try
 > rewriting the program in JavaScript. If it behaves in the same way, it's
 > not a D bug.

Right.

I remember Seth Ladd's Dart language presentation at the local ACCU in 
Silicon Valley. He was explaining how Dart was different from other 
languages in this respect. I think he had mentioned JavaScript with the 
behavior that he was not fond of, so he had designed the language the 
way OP wants.

He explains it here:

 
http://blog.sethladd.com/2012/01/for-loops-in-dart-or-fresh-bindings-for.html

Ali



More information about the Digitalmars-d mailing list