News for hackers. Stuff that matters.
Re:We were wizards – a foreword to Learning Perl by kstenerud on Sunday March 17, 2024 @03:05AM (#39732492)
Bashing Perl is a meme precisely because of the mentality of the creators of Perl (who set the culture). This "Forward to Learning Perl" epitomizes the mentality: Imagery of wizards, alchemy, breaking all the stuffy rules that quashed creative thought, etc. He even says "bowing down at the Temple of Orthogonality" like orthogonality a bad thing!

It hearkens back to the days when motor cars were curiosities that required frequent tinkering and had no safety requirements. The sky was the limit, but your car could blow up.

Perl was rightly bashed because it was the poster child of cowboy coding, which flies in the face of good engineering practices: Understandability, predictability, reproducibility, measurability, safety. This allows you to use a product with confidence. I had the misfortune of inheriting some cowboy code, and to this day I call a pox upon the writer. His lack of discipline caused YEARS of misery and maintenance costs; far outweighing any temporary benefit he provided.

Newer programmers might not have lived during the bad old days of cowboy coding, but I did. Nothing was documented. Nothing really worked because there was no edge case support. The mentality was "If it was hard to write, it should be hard to understand" and "If you're not happy with it, feel free to modify the code" (their impenetrable code). Basically, pass-the-buck for your own lack of discipline, and then blame the user.

Personally, I'm glad we've moved on towards becoming a serious engineering discipline, complete with UX being a thing.

Re:We were wizards – a foreword to Learning Perl by mdavidn on Sunday March 17, 2024 @03:50AM (#39732678)
I'm glad you found a corner of this industry with "serious engineering." It's still the wild west in web development. Today the creators of frameworks chase engagement metrics rather than wizardry, but the end result is the same.
Re:We were wizards – a foreword to Learning Perl by alfiedotwtf on Sunday March 17, 2024 @03:26AM (#39732570)
Cowboy Coding is not a language thing, it’s a mentality thing. I’ve seen many beautifully crafted Perl projects. “Perl Best Practice” was a thing
Re:We were wizards – a foreword to Learning Perl by hnlmorg on Sunday March 17, 2024 @04:35AM (#39732880)
> Perl was rightly bashed because it was the poster child of cowboy coding, which flies in the face of good engineering practices: Understandability, predictability, reproducibility, measurability, safety.

That’s the meme, but it’s simply not true.

I’m going to use Python as a basis of comparison because that’s the language which, from my perspective at least, seemed to replace Perl.

> understandability

A lot has been said about sigils but ultimately a language is only as familiar as a developers exposure to it. Python appeared easier to understand for the newbie because it favoured words over expressions but now that Python has matured it’s become just as incomprehensible too.

> predictability

I’ll be the first to admin that there are a couple of really massive footguns in Perl which are remnants of its evolution as a shell tool. But there’s other aspects to the language which are really clever. For example the way Perl does type comparison is much more predictable then Python.

On the whole, I think those languages are about equal.

> reproducibility

CPAN was also light years ahead anything also available at the time. And still is in many regards. For example, Python environments is a mess. Perl is one of the most portable languages out there. Want to change the state of the runtime? Just add a line to the top of your source. Simple.

Python and JavaScript are a completely pain in the arse in comparison.

PHP is another example of a language that gets this right. Few people on here (myself included) will have much love for 2010’s PHP but it just goes to show that a lot of the languages “real programmers” praise do actually suck at a lot of the basic principles.

> measurability

Not really sure what this is intended to refer to. Maybe APMs? Either way, a lot of diagnostics like that came into vogue after Perl’s decline so this isn’t really the fault of the language but more just 3rd party tool writers putting their focus elsewhere.

That all said, don’t be fooled into thinking such tooling doesn’t exist for Perl.

> safety

Perl basically invented unit tests amongst the scripting languages. It also has stricter run modes to differentiate between one time scripts and important business code.

Saying Perl lacks safety demonstrates a lack of experience with the language.

——-

I’ve written production Perl, PHP, JavaScript, TypeScript, Python, C++, Go, Bash, Visual Basic and even Pascal. De-mangled other people’s spaghetti code in all of those languages too. Probably a few languages I’ve forgotten about too. Perl is one of those languages people love to hate but is, in my opinion, one of the most misunderstood.

[edit] I should have added a comment about Perl’s backwards compatibility. Few other languages even come close to the longevity of Perl 5. And that commitment extends down throughout Perl’s ecosystem. With JavaScript I’m constantly scared the next npm update will break the project.

Re:We were wizards – a foreword to Learning Perl by singingfish on Sunday March 17, 2024 @05:14AM (#39733028)
Back compat is an important thing. A few years ago we took a 250kline from perl 5.8.9 to perl 5.16 in one hit. Out of the entire application under 50 lines of application code needed to be changed (excepting the big bump in cpan module versions). Currently I'm slowly finalising the move from 5.16 to whatever debian stable is currently shipping 5.34 maybe? The biggest pain point is some type safety in the elastic search cpan module. Other than that I've had to slightly refactor some hacky but effective cache invalidation startup code due to a weird `perl -e` bug I found but can't characterise sufficiently precisely to report. The only reason that the perl latest upgrade wasn't done incrementally was because of a super weird unicode bug between perl and the oracle client library which is now out of scope for us.

But I agree perl can have bad management problems because of different people's capabilities, and different people's approach to showing their individuality.

Re:We were wizards – a foreword to Learning Perl by lloeki on Sunday March 17, 2024 @05:13AM (#39733023)
> safety

You forgot safe mode and tainting, which while imperfect and has some sharp edges, is a first class construct that when correctly wielded outright prevents classes of attacks like shell or SQL injections or XSS.

Some have been reinventing it in a piggybacked way, and so, partially/poorly (comparatively), e.g Rails's safe/unsafe strings in ActionView.

Re:We were wizards – a foreword to Learning Perl by alfiedotwtf on Sunday March 17, 2024 @05:06AM (#39732988)
>> safety > >Perl basically invented unit tests amongst the scripting languages. It also has stricter run modes to differentiate between one time scripts and important business code.

Don't forget Tainted Mode! It's 2024 and I still have never seen it adopted in any other language. It's essentially SELinux-lite for variables :)

IMHO Perl lost to Python because of 3 reasons: 1) Google at the time chose Python and it was the new cool startup everyone wanted to work at, 2) Pandas and Numpy weren't matched in the market (I'd even argue this is still true in 2024), and 3) Perl 6 was way too ambitious and scared people off (even though Perl 5 was never going to go away overnight (and still hasn't))

Re:We were wizards – a foreword to Learning Perl by HybridCurve on Sunday March 17, 2024 @05:52PM (#39738380)
Some of the arguments about Perl and bad engineering practice are not entirely without merit. Neglecting 'use strict;' or 'use warnings;' in your script typically makes this more apparent. The language itself however does not attempt to constrain developers in the same way modern languages do, instead the burden of responsible engineering is placed on the developer. The result is people that deal with badly engineered Perl typically become sour to the language itself.

I reserved my criticisms of Perl for things like signal handling and it's implementation OOP(to name a few), but overall it's a good language.

Re:We were wizards – a foreword to Learning Perl by alexey-salmin on Sunday March 17, 2024 @05:10AM (#39733000)
People often forget how bad things were in 2000s. A "serious engineering discipline" usually meant Java and "writing a unit test and five lines of docstring for every get/set method". I'd go for wizards and alchemy any day.

Even today many of the "serious engineers" of the time still roam the industry and show up for interviews every now and then, completely unable to write code. Some even capture younger souls into this trap, a sad picture.

Re:We were wizards – a foreword to Learning Perl by llm_trw on Sunday March 17, 2024 @06:52AM (#39733465)
>I'm glad we've moved on towards becoming a serious engineering discipline

To quote the immortal Bender:

>> Oh wait, you're serious, let me laugh even harder.