The One With D News and Opinions of the Digital Mars D Programming Language

12Sep/070

On Closures in D

Slow news day for D, but there's a blog post over at hans-eric.com titled, D doesn't have real closures. Hans-Eric talks about D's delegates, how they are similar to closures, and how they aren't quite real closures because they don't keep surrounding variables alive after the scope has changed. His conclusion is that it's not a big deal, but at least one commenter so far disagrees with him.

Personally, I don't see it as a big deal either. For my purposes, I don't really need true closures in D. I do like to see them implemented in scripting languages, though. They are very handy for game AI. Since Lua added closures, that has become one of its major selling points for game developers. If I do come across a case where a true closure would come in handy, I have no problem making use of an inner class instead. D just has so many other useful features, such as anonymous delegates and lazy evaluation (two among many), that not having true closures doesn't bother me a bit.

Technorati Tags: , ,

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.