Closures; an Italian Sonnet

Posted 2006-05-18…

I was recently challenged, in jest, to write a poem on closures. I was waxing poetic on the idea of closures as method “templates,” and Chad called me on it.

I could have answered Chad’s joke with a haiku, but who can truly contain their love for closures in only a few lines?

Instead, I figured an Italian Sonnet would be much more punishing for all involved, and somewhere where I could truly showcase my inherent nerdiness.

So, without any more ado…

A shame, it seems me, that closures still

Are not lauded, not given their just due;

Objects rock, but no paradigm’s so true,

That should eschew the useful closure’s thrill.

The outer scope, the fortress on a hill

Is not opaque; the closure has a view

Of variables assigned before— into

The closure goes a binding’s heart and will.

Closures seem like method templates; see

Filled with variables that are in turn contained,

This stencil used to fill a binding’s dreams,

No banal limits, no local scope constrained.

So pivotal, these functional gems agree

With metaprogramming and other utopian schemes.