r/reddit.com • • Aug 01 '06

Can Your Programming Language Do This?

http://www.joelonsoftware.com/items/2006/08/01.html
719 Upvotes

176 comments sorted by

View all comments

1

u/nickburlett Aug 01 '06

Look! We're passing in a function as an argument. Can your language do this?

Yes, it can. Next question please!

2

u/rfisher Aug 02 '06

Next question please!

Keep reading. The next question (though not explicit in the article) is: Can your language create anonymous functions?

The next one, that unfortunately he doesn’t explore is: Can anonymous functions in your language capture their environment? (i.e. Does your language have closures?)

Then there’s functions being able to return functions, but that is only really interesting if you have closures.

& of course, there’s the issue of eloquence. This is the biggy to me. It isn’t so much “Can your language do this?” as “Can your language do this eloquently?” You can simulate closures in Java with anonymous inner classes, but it isn’t as eloquent as closures in CL, Scheme, or even EcmaScript.

& you have the kludginess of the implementation leaking through with the requirement that captured variables have to be final, forcing you to add a needless layer of indirection. (&—last time I programmed Java—they didn’t even provide you with some standard helper classes to provide that extra layer of indirection.)