Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

"Why contrive a name for something that will never be called anywhere else? Why contrive a name for a block of code that only makes sense in one place in the source?"

This is one of the compelling arguments for favoring C++11 over C++98(03): In older flavors of C++ the standard algorithms often required that a functor class be passed in, for example, as a comparator. Believe it or not (I'm sure you already know this, though), people had to go to all the trouble of creating a named class with an overloaded operator(), and then pass that named class to a standard algorithm just to do simple things like calling a sort routine, or a binary search routine on non-POD types. And even then it might be necessary to overload operator< as well. C++11 finally provided lambda functions, which allowed users to stop going through all the silly work just to create a comparator that would be used in only one place. In other words, in this regard, C++11 finally gained the ability to make something that should be simple, relatively easy as well, and this is one of the things that has made C++ fun, finally. Perl has had anonymous functions for...well, I don't know how long, but at least dating back to when sort and map made it into the language.

So what I don't get is, after all these years, and after so much work has gone into making older languages like C++ adopt the approach, why people still say, "now why would you want that?"


Dave


In reply to Re^8: I want you to convince me to learn Perl by davido
in thread I want you to convince me to learn Perl by kasxperanto

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-24 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found