Can’t Hack It

An attempt at public introspection


Martin Fowler on Closures

· 1min

Martin Fowler’s talking about closures on his blog. I was rather disappointed that he didn’t bring up JavaScript when he was talking about it.

Why do I mention it, besides the fact that I like JS as a language? It’s because it’s given far less credit than it deserves: JavaScript more than any language is the one that has done the most to popularise and spread closures as a concept. As Eric Lippert noted, “Waldemar Horwat—who was at one time the lead Javascript developer at AOL-Time-Warner-Netscape—once told me that he considered Javascript to be just another syntax for Common Lisp. I’m pretty sure he was being serious; Waldemar’s a hard core language guy and a heck of a square dancer to boot.”

Closures are what allow OOP in JS, and prototype-based OO like that of Dylan and JS is without a doubt far more powerful and flexible than class-based OO. Ah, the terrible lightness of being misunderstood.