Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re^8: I want you to convince me to learn Perl

by davido (Archbishop)
on Nov 24, 2013 at 05:38 UTC ( #1064098=note: print w/ replies, xml ) Need Help??

in reply to Re^7: I want you to convince me to learn Perl
in thread I want you to convince me to learn Perl

"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?"


Comment on Re^8: I want you to convince me to learn Perl
Select or Download Code
Re^9: I want you to convince me to learn Perl
by BrowserUk (Pope) on Nov 24, 2013 at 09:35 UTC
    Perl has had anonymous functions for...well, I don't know how long,

    From the index in perlfunc: "* - sub was a keyword in perl4, but in perl5 it is an operator, which can be used in expressions.".

    That said, map/grep/sort have the ability to take bare blocks and even 'bare expressions', which are pretty unique to Perl, and (I guess, but don't know) might have been possible prior to perl5.

    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?"

    It comes as no real surprise to me. They are the same people that eshew map & grep and ?: and a whole bunch of similarly 'non-traditional' programming constructs and concepts as 'unclear' or 'too complicated'. The only thing that really surprises me is how widespread the notion is that all such HLL constructs are somehow 'clever hacks' or 'obfuscation'.

    With regard to C++11. I think the only real problem with it is that in order to make best use of the power and conciseness of the new constructs and libraries, you basically have to relearn the language from scratch and unlearn your dependencies upon libraries like Boost.

    With so much legacy C++ around, not to mention those C++ programmers that will never make the transition to the new ways of thinking that are enabled by +11 and will be required to fully realise the benefits from it, it'll take another 10 or more years before the new generations of programmers coming through -- for whom it will all be natural and normal and obvious -- will usurp the reins of project control sufficiently to legitimise the new ways of working and finally consign the old-school patterns to the bit-bucket.

    Perhaps the single, most exiting thing about C++11, is that for the first time the standards body have accepted and adopted the concept that less is more into the language design. The idea that programmers are actually quite adept at getting to grips with and utilising higher levels of abstraction and that not everything has to be verbosely and laboriously laid out and stated explicitly.

    Of course, it will take another 20 years of deprecation cycles, new minds and retirements for the full affects and true potential to become fully realised, but if this were any other industry the same levels of change and turn around would require 50 or even 100 years, so I guess its not so bad if you consider it the light of history. Still, it's one of the few things that make me wish I could go into stasis for 20 years and then pick up programming from that point going forward.

    Once Moore's Law has plateaued as it will, and concurrency is both ubiquitous (as it is) and *must* be utilised (as it will have to be), and architects and managers can no longer throw hardware at problem s to achieve scale because of the energy costs, the current way of program development -- and I mean the entire way of working as exemplified by TDD and agile -- will need to replaced by methods that don't require programmers to write 3 lines of code for every one that actually gets used, and don't require every low-level operation -- like reading a line of data from a file -- to use 3 or 5 lines of code and be re-written for every new program.

    Programmers will have start using the very machines, tools and techniques that they currently apply to speed up and economise everyone else's jobs, to their own work. And once we stop hand-fettling every line of code and test and operation; and start using our skills to turn programming into the programming equivalent of CAD/CAM manufacturing and maybe even additive manufacturing.

    Only then will we stop tendering out entire projects to the black hole development processes that we currently use, that mean we don't discovered the flaws and overruns until 18 months down the road when we've spent millions and nothing works. Instead, software projects will be designed like any other large scale assembly project; with small components bought in from specialist development companies by competitive tender. And probably multi-sourced; with interchangable components being purchased from several suppliers who not only write the code to spec. but are charged with both maintaining and improving those code components going forward as a part of the purchase price.

    Sorry. Now I'm just imagining and rambling. But still, its a world I wish I could be a part of.

    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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1064098]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2014-07-23 23:22 GMT
Find Nodes?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:

    Results (154 votes), past polls