Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I agree and as I said closures are somehow the other side of the OO coin in allowing encapsulated variables.

Indeed. One of my very early posts here was a OO class that used closures to produce a JS-style prototypical OO mechanism.

Looking back at it I'm not sure it'll win any plaudits for maintainability, but it was a great tool for learning the power and limitations of closures.

It's like saying why do we need lexical variables, as long as we care about chosing the right package-namespaces we can achieve the same.

I appreciate the analogy, but if you look back, I wasn't reaching any conclusions with my thoughts about closures, just examining the evidence.

As with many other ideas that suddenly gain currency -- despite usually having been around in one form or another since the '60s or early '70s -- I like to examine 'new ideas' every so often and try to see through the theory-wash, marketing speak and hyperbole, and reach my own conclusions as to their usefulness and importance.

Through this process I have avoided getting swept alone by many a fad that has subsequently shown itself to be of dubious value. I tend to apply the same criteria to most everything in life.

As far as closures go; I think I reached the conclusion that they are a valuable addition to languages so long as their implementation does not exact too high a price on the performance of the rest of that language.

Done right, they are a useful addition to the toolbox; but I wouldn't want to throw out (or ham-string performance-wise) too many of the other tools in the box to accommodate them.

Continuation passing on the other hand seems to exact too high a price.

I think it's also part of the feature competition.

That's essentially what I was wondering. Are closures just another 'we must have that too' kick.

I think they are somewhat more than that.

Saying this you might have noticed that some participants in this thread didn't really know what closure.

Indeed. But that is also true of many a dissertation on them that you'll find online.

But when I first encountered SmallTalk's block arguments; their significance was lost on me also.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^6: Real life uses for closures. (update: disambiguation) by BrowserUk
in thread Real life uses for closures. by BrowserUk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (3)
    As of 2018-02-25 12:28 GMT
    Find Nodes?
      Voting Booth?
      When it is dark outside I am happiest to see ...

      Results (312 votes). Check out past polls.