Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
> I was also quite happily solving my programming problems in languages that don't support them for 15+ years before I became acquainted with them.

I agree and as I said closures are somehow the other side of the OO coin in allowing encapsulated variables.

Just more elegantly done with less code in most languages.

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. True, but most of us don't wanna code Perl4 anymore!

> I've been reading a lot about constructing interpreters and VMs lately, and one thing that seems common to most new ones is the seemingly obligatory inclusion of closures;

I think it's also part of the feature competition. Like "What you have no App to shave your legs on your new smartphone"?

OTOH what I really like about JS is that it does FP (almost¹) excatly like Perl, while Ruby and Python suck at closure side-effects.

IMHO it's far easier to port FP-patterns than OO-patterns, and closures are indispensable for it.²

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

So yes you, can be a very efficient programmer w/o closures.

Cheers Rolf

¹) well exactly if you have a dialect allowing to swap var with let.

²) And we have this "one package per file" paradigm, which forbids to just add another encapsulation on the fly. (No fun discussing the perl critic addicts)

IIRC correctly there was a nice thread where GrandFather solved a problem with an embedded mini-class where I used closures... If I can find it, I'll update.


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

Title:
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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (9)
    As of 2014-07-30 02:00 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (229 votes), past polls