Clear questions and runnable code
get the best and fastest answer
Re: Curious about Perl's strengths in 2018by bliako (Prior)
|on Apr 14, 2018 at 12:20 UTC||Need Help??|
Programming languages can be compared in many different ways, of course. But there is a metric which is the most important. Economy: capturing, harnessing and training programmers (much like mustangs) or just mass-producing them at university breeding stables (much like work-horses). Then it is the ease of breaking down programming tasks and their distribution to teams all over the world (in order to exploit local wage differences etc.). Also, risk of bugs, cost of maintenance and refactoring. In this metric Perl is somehow inferior to others. But strictly-typed, OOP languages will always win here anyway.
The second most important metric, again based in my very limited experience and less on knowledge, is how much it allows you to build on the work of others: 3rd party libraries. CPAN is full of high quality modules in standard more or less format (wrt doc/test/install). Last night I needed a tree implementation. LOTS of trees in CPAN! Add to this excellent package managers, for example cpanm, and excellent multi-environment managers like Perlbrew. And excellent forums like PerlMonks. In this metric Perl is in par with every other contestant if not winning single-handedly.
Third metric, built-in data structures. The Hashtable was first given to the masses via Perl (ok, awk has it much earlier but we are not talking about masses exactly here).
And the masses loved it and swear by it ever since. What an impact by Perl! But who remembers it and who cares?
Python picked it up too but later (correct me if wrong). Then Java (and JS/ES). But C++ never dared to do that then, when it did matter. Today they introduce any nilly-willy idea they read in Cosmopolitan every couple of weeks to the point of ridiculousness (and the breaking of my systems). Who needs knee-jerk reactions?
So, in this metric Perl won but victory has no meaning. Now all contestants offer this and some of them overdo it (e.g. Java). So all equal here I believe.
Lastly, there is the question of Optimisation of practices, resource allocation, distribution galaxy-wise if possible. Bear with me for a moment...
There is a top-down approach to it where a path is followed to optimality, much like climbing a mountain. And there is an "anarchic" way: unleash a billion ants to climb to the honey at the top each following a random path. Very useful when we are not sure where the highest peak is. And have lots of ants. Darwin expressed the idea of the survival of the fittest. Something that is often ovderlooked is that it requires a massive population breeding and eating each other.
Genetic Algorithms, as in AI, model exactly that but in Computer Systems. And Genetic Programming takes it even further to creating optimal (computer) programs as a result of breeding and eating each other along with random mutations here and there. (Do not hurry to say that GP did not fly. Neural Networks died and resurrected many a times, each time stronger.)
It is my opinion that Optimisation should be the first concern in the mind of any person who is a "scholar" in the sense that he/she cares to see a bit further than how the daily bread is brought to the family table. To any manager and "chief executive" (gosh!), to any government official (gosh!) should be the first in their mind. Alas it is not. Because the (prevalent) economic system dictates that it is short-term profit maximisation which matters. De facto: Bonuses are distributed every year, CEOs and politicians are elected every five (~~). What incenctive do they have to think long-term? Like 30 years from now? 50 years ago the "short-term" was 30 years, today is maybe 18 months. (Interesting side-note: the taking of GKN which is a supplier for Airbus Airbus warns over Melrose's £8bn GKN takeover : Airbus, said the industry was not suited to "short-term financial investment")
I digress. Anyway, Optimisation should be first in our mind when we judge anything that has to do with our future. And because nobody is sure about which path to take to the highest peak (which we can not see anyway) I favour the second model, the "anarchic" bottom-up massive unleash of tha ants. Maybe with educated top-down guesses and heuristics and of course with a set of rules which are HUMANE. No need for the deadly competition of today, neither the marginalisation of people and ideas.
And here is where the Programming Languages come in: what is their role in this Optimisation? Now this is a Metric!
This is a Digital era and there is no going back (unfortunately i say). The spade and the steam-engine of our times is Computer Systems and Computer Programs are what move them. And so Programming Languages are important part of Optimisation. But we need to ensure that the competition of ideas and toolsets is as wide as possible in order to have better chance to arrive to good solutions - to evenly visit the landscape so-to-speak.
One of Perl's underlying (and I guess uncompromising) principle is There's more than one way to do it (edit: a point many fellow Monks mentioned already here and also I mentioned it in another comment which is cited here). It fits exactly in the model of Optimisation I have just described. It is very important. And in my opinion it is Perl's most important strength for 2018 until 2058 and 2258. Please note: underlying principle and not just a random side effect. You are what you program with. Maybe Perl will die out one day but the spirit survives and also within the walls of this Monastery.
Onwards Brothers and Sisters! The spirit of Optimisation is the spirit of Perl.
Contrast and compare that to others notably Java, C++ and Python. Btw the latter I distaste so much - both language, creators and users - I thought it unfair to make any further comment about it.