Live data from Hacker News

Not Your Grandfather’s Perl

stackoverflow.blog

161–170 of 257 posts

Re: Not Your Grandfather’s Perl

#161

Perl receives such an unnecessary amount of hate

I don't think it's hate. I think it's more "why would I choose Perl over Python?" Perl has a painful syntax, Python greatly improves on this with easy syntax. I don't want to have to relearn the syntax every time I reach for a scripting tool.

Python was an obscure algorithms language until Google standardized around it, if they hadn’t we wouldn’t be talking about it. Not to say it’s good or bad since that’s silly and evaluating languages is complex and context sensitive, but IMHO Python isn’t popular because it’s great, even if it is.

Re: Not Your Grandfather’s Perl

#162
post #76
post #37

Earlier quoted context omitted.

The point is not about `say` itself (which has been there since Perl 5.10, released on 2007/12/18), it's only an example of how much Perl uses modularity (via `use`) to enable new features while ensuring a) code dependent on a new feature alerts on Perl versions without the feature and b) backward compatibility of new Perl versions with old Perl code. Compare: # Perl use feature 'say' vs: # Python from __future__ imp…

This. So much this. At the $dayjob, writing some python assuming late model 3.10.x, and discovering that the API has changed when I have to make sure it works on 3.6.x and 3.7.x. Nevermind important libraries like pandas changing the API so some functions you 've used for years just disappear. I've got 30+ year old perl 5, that just works. And is readable. I wish 2 year old python could just work.

Say what you want about Java, but back- and forward compatibility have always been a big priority and part of its success story. No Java developer would be surprised at 30 year old code just working (ironically, it's more likely than for 10 year old code).

Re: Not Your Grandfather’s Perl

#163
post #94

Earlier quoted context omitted.

I would argue that ruby as almost all the strengths of perl and conciseness with more coherency if you want a perl-like fluidity and terseness. I personally like python for anything that becomes more than a 100 lines of bash.

Due to poor coding practices (eg monkeypatching) and a weaker testing culture (by default Ruby does not run unit tests when installing libraries) I've found Ruby to be substantially less reliable than Perl. However the world has moved on to Python. So I curse every time I again have to look up how subprocess works for what I'd do in Perl with backticks.

Check out plumbum: https://plumbum.readthedocs.io/en/latest/

It supports mac, Linux and windows.

Re: Not Your Grandfather’s Perl

#165
post #94

Earlier quoted context omitted.

I would argue that ruby as almost all the strengths of perl and conciseness with more coherency if you want a perl-like fluidity and terseness. I personally like python for anything that becomes more than a 100 lines of bash.

Due to poor coding practices (eg monkeypatching) and a weaker testing culture (by default Ruby does not run unit tests when installing libraries) I've found Ruby to be substantially less reliable than Perl. However the world has moved on to Python. So I curse every time I again have to look up how subprocess works for what I'd do in Perl with backticks.

TIL (as a light Perl user alternative to awk) CPAN runs test on install. Is there any other language package manager runs tests by default?

Re: Not Your Grandfather’s Perl

#166
post #129

Earlier quoted context omitted.

"Perl makes easy things easy and hard things possible."

What we need from a programming language is to make medium complexity things, at worst, medium difficulty. I don’t care about hard problems, and easy problems.

Erlang/OTP does medium difficulty things, i.e. very large applications with good fault tolerance and QoS, really well.

But it's a very different niche. Perl and Ruby scale to mid sized applications quite well, but above that fault tolerance and QoS become hard.

Re: Not Your Grandfather’s Perl

#167

Earlier quoted context omitted.

Kind of caught up. I don't think there's much like cpantesters and the strong emphasis on testing elsewhere.

Agreed, and the cpan shell too.

I haven't used the cpan shell for a long time `cpanminus` does everything I need with a great deal less pain.

Re: Not Your Grandfather’s Perl

#168

Perl receives such an unnecessary amount of hate

I don't think it's hate. I think it's more "why would I choose Perl over Python?" Perl has a painful syntax, Python greatly improves on this with easy syntax. I don't want to have to relearn the syntax every time I reach for a scripting tool.

The reason to use Python instead of Perl is that you can do `python3 -mvenv env`.

Actually using the language itself is far less painful in Perl than it is in Python.

Re: Not Your Grandfather’s Perl

#169
post #52

Earlier quoted context omitted.

Does Ruby come pre-installed on virtually every Unix-like system out there?

No, and if it is, who knows what version it is. I think that's the main thing preventing one from using ruby like this. It is otherwise preferable in pretty much every way. Perl is kind of pre-installed on virtually every Unix-like system for what are at this point historical/legacy reasons. It is unlikely any other language can ever achieve this at this point.

Indeed. As much as I would like to use Ruby or Raku for this type of stuff, I keep coming back to Perl because it's simply... there.

Sure, I could probably install Ruby on any machine I want it, but it's not just technical availability. Socially, Perl serves as a quite obvious Schelling point. I don't have to convince four other people to learn Ruby, because Perl is what everyone would gravitate to even in isolation, again because it's just... there.

(That said in recent years I've had to switch to Python for some things aimed at a younger audience. Oh well.)

Re: Not Your Grandfather’s Perl

#170
post #129

Earlier quoted context omitted.

One of my criteria for good tools is that they scale well from the smallest possible use case to absolutely massive. Git meets this criterion for example. Anyway I manage a 250kline code base written over 20 years which is in surprisingly good shape consider it's age and how many people have touched it. Last time we upgraded the perl for the first time in a decade - going through the addition of many features and maj…

"Perl makes easy things easy and hard things possible."

Getting strings to have the right encodings should be easy. On the last Perl codebase I touched it's proven impossible for all practical intents and purposes.
Post reply on HN