hello,

as intro: i would like to make clear that i'm not promoting perl (my go
to langage for scripting is now raku by far) but as i was a member of the perl
community more than 20 years, i have some opinions about it.

> felt like a random hack, especially compared to ruby. The only thing I
> really miss from python is "yield".

why is this ? return is the perl yield. the only difference is that the
"exhausted" situation is on your own. so basically:

    def count_from(x):
        while True:
            yield x
            x = x + 1

    naturals = count_from(0)
    print(next(naturals))
    print(next(naturals))
    print(next(naturals))
    print(next(naturals))

is written in perl

    use experimental 'signatures';
    use feature 'say';

    sub count_from ($x) { sub { $x++ } }
    sub NEXT ($generator) { $generator->() }
    my $naturals = count_from 0;

    say NEXT $naturals;
    say NEXT $naturals;
    say NEXT $naturals;
    say NEXT $naturals;

there are complete modules on CPAN based on this. Perlude provide
keywords stolen from haskell to make things more like shell scripting
so the equivalent of

    grep root "$@" | sed 100q

is

    use Perlude;
    now {print}
        take 100,
        filter { /root/ }
        sub    { <ARGV> // () };

Perlude is available on CPAN:

    https://metacpan.org/pod/distribution/perlude/lib/Perlude.pod


> and ruby in parallel and ruby was definitely the winner there. I have
> absolutely no idea why python even gained the popularity it has, it

my opinion: python gained popularity during the dark ages of internet
when most of the people (including developpers and IT people) were using
windows and teach themselves how to use a computer or worse: learned
from java schools.

so python won because:

* they took care about windows users
* the langage is designed to provide simple solutions for simple cases
  which please most of the users (they don't need to maintain large
  codebases)
* the default behaviors of the langage were the same than the langages
  learned in the java schools (POO, ...). the most obvious example is
  the "flatten values by default":
  * it became the center of the stupidest talk ever
      
https://media.ccc.de/v/31c3_-_6243_-_en_-_saal_1_-_201412292200_-_the_perl_jam_exploiting_a_20_year-old_vulnerability_-_netanel_rubin
  * thanks to javascript, (with the rest operator and the
    destructuring syntax) they now all get the point and even python
    dpeople now have access to those features and like this.
      https://youtu.be/ggbi4SelOAo?t=955

so perl didn't fit the needs of the internet bubble

* perl were about unix culture, mailing lists and so on: they setup a
  confortable cocoon to work together and this cocoon became an echo
  chamber when the other communities started to use third party services
  like stack overflow.
* something i call "the 'hello world' pride": when perl programmers were
  just putting new modules on CPAN to get the job done, python ones were
  creating tools and projet sites and so on with a logo "powered by
  python". this has an impact on the myth of "perl is dying"
* the python community was unfair comparing the langages (using ugly
  perl code and nice python counterparts). instead of taking time to
  explain all the biases, perl community repetedly asserted that the
  authors of those article were incompetents and gone away.
* same situation regarding the constant FUD from the other dynamic
  langages

perl people didn't realised how unixish perl is:

* it's sad to realize that even linux users of nowaday are not
  confortable with the basics of awk, sed and so on ... and perl
  is born by improving the concepts of those langages and putting
  them together in one tool. it means that learning perl is easy for
  unix users: not for the rest of us. combined to the "DWIM" moto, perl
  has some unexpected behavior because it implies you should *know* what
  you should mean (which implies a unix culture).  the most obvious
  exemple for me is the fact that <> iterates by default on ARGV, not on
  STDIN: ARGV is what you need to know when you want to write a filter
  but it's way too magic when you don't know the unix philosophy.

* when perl gained popularity (the realm of CGIs), lot of aweful scripts
  were written by newbies both in perl and unix. the result was terrible
  and gave perl a very bad reputation.

regards
marc



Reply via email to