News for hackers. Stuff that matters.
Re:Execution in the Kingdom of Nouns (2006) by Roboprog on Wednesday February 13, 2013 @12:41PM (#5214432)
You can fake objects and subclassing with closures, in addition to making it trivial to implement the "one method interface" (aka "functor").

http://roboprogs.com/devel/2010.06.html (example using a subset of JavaScript, rather than a language likely to be unfamiliar to most)

TODO: edit example someday to get rid of "useless use of local variables" (in place of original formal parameters), fix where I call the outer functions "closures" instead of the inner functions.

Of course, it's easier to work with both real objects AND real functions/closures/lambdas -- I can use a hammer and a screwdriver :-)

Re:Execution in the Kingdom of Nouns (2006) by daxelrod on Wednesday February 13, 2013 @06:04PM (#5216322)
I always thought this koan summed up this concept best: http://stackoverflow.com/a/501053/580947
Re:Execution in the Kingdom of Nouns (2006) by seanmcdirmid on Wednesday February 13, 2013 @08:42PM (#5217079)
> Of course, it's easier to work with both real objects AND real functions/closures/lambdas -- I can use a hammer and a screwdriver :-)

But do you hit your screwdriver with the hammer, or do you twist your hammer with the screwdriver? This can be a real problem if one programs in Scala.

Re:Execution in the Kingdom of Nouns (2006) by Roboprog on Thursday February 14, 2013 @11:04AM (#5220039)
Not too often, but I find myself using the screwdriver for a chisel, and the hammer for a plumb bob.

I probably need to buy more tools :-)