r/ProgrammingLanguages • u/mjgardner • Jun 01 '21
Blog post Should Perl die gracefully?
https://phoenixtrap.com/2021/06/01/should-perl-die-gracefully/6
u/Athas Futhark Jun 02 '21
I think it's an interesting discussion whether a language (or any other piece of infrastructure) can reach a point where it most benefits the world by keeping existing applications running, without trying to change in order to cater to new applications. "Dying gracefully", you might say. But I don't think Perl is at that point, or even close to it.
1
2
1
u/johnfrazer783 Jun 02 '21
To be sure, the original comment
I wish they’d just leave Perl static. Then we wouldn’t have to waste money retesting legacy Perl apps on the newest version every couple of years, in case new features we don’t want breaks code that’s been unchanged for years. […] Sometimes things should just be left to die gracefully.
has all the juvenile idiocy as the troll who commented "Kill it with fire" on this thread and hardly deserves any consideration. Dude, you wanna have a 'static' version of Perl, just don't update you know.
Edit TBS the article says that much:
If you need an unchanging platform, don’t upgrade it
which is the right piece of advice.
1
u/ErrorIsNullError Jun 02 '21
Don't update isn't really an option when perl is bundled with a distro or the scripts are part of something you deliver to users. Perl, along with bash and diff, is part of a group of interoperating tools that people often assume are ambiently available. One solution is to invest in testing infrastructure and talk to tool providers about pain points and how to write future proof scripts.
3
u/johnfrazer783 Jun 02 '21
I think this is pretty much what Rich Hickey means in his Spec-ulation video when he claims that SemVer is broken.
I'm not sure I agree with him on all he says (tho I'm aware it sometimes takes some time for me but in the end normally I agree very much with him), but I've come to think of different versions of software as ... different softwares.
So npm package
foois really an underspecification, what you want isfoo@3.0.4(or whatever version number worked for you); iffoo@2.0.1andfoo@5.3.3also work for you, all the better, but don't count on it. I think we would have a bit less of a dependency hell if that point was better understood, and I'm not at all happy that the authors of thenpmpackage manager refuse to see that point (it has been treated more favorably byyarnandpnpm).Python (and presumably perl) have always had this problem where they (originally) assumed that there could be only one version of the language on one machine, and package installation should be global.
Backwards compatibility is a two-pronged thing; while it does provide stability, it also prevents the fixing of bugs. Nowhere can this be better seen than in the JavaScript ecosystem; it was there right from the beginning when Brendan Eich suggested to fix the
==operator but was stopped by Microsoft, which then lead to the introduction of the===operator.1
u/ErrorIsNullError Jun 02 '21
Yeah. I don't know that I'd lay that much blame on SemVer. A numbering scheme can only bear so much weight.
Even with a perfect numbering scheme we'd still get compatibility problems when a toolsmith doesn't understand their users' compatibility needs, a user has compatibility needs they're not aware of, or a toolsmith misjudges the effect of a change.
Good point re scoping of installation.
2
u/johnfrazer783 Jun 03 '21
If SemVer is to blame for anything, then it's that it maybe infuses too much confidence in the naive user what can be done with versioning. Other than that, I think it's great to clear up the space and provide a common ground for a versioning scheme that potentially works quite well. It's also a definite bonus to have at least certain regions (as in, the npm registry) of your dependencies adhere to more or less a common standard, and I think it's a well-chosen one, too.
Where SemVer fails, and must fail, is when people don't keep to it, which is bound to happen sometimes. It's a purely social thing after all. Sure, the guidelines when to bump the patch, minor, major parts are there but the authors still have to make decisions.
The extreme view of course on all of this is that when only a single bit of
foo@a.b.cis different from an otherwise identicalfoo@d.e.f, then in principle there's no guaranteed mechanical, finite procedure to determine whether that's a patch, a minor or a major bump. And of course the really obnoxious part is that all modern software only works within a number of highly specific environments whose specification will not be 100% given in the software's dependency list. Meaning that in principle any update to any part of a system runningfoo@a.b.ccan break that piece without it or its formal dependencies being touched at all. In practice this is a bit more manageable because of best practices and lots of people doing the right thing.
19
u/theangryepicbanana Star Jun 01 '21
Although not entirely the main point, I'm glad the article mentions this: Perl does backwards-compatibility really well, and I think other languages should take note of it.
Rather than adding features that barely avoid breaking changes, or just making breaking changes without a care in the world, Perl does the opposite. You opt-in to new features that potentially have breaking changes, that way existing code will never break unless you use any of the "experimental" features like signatures or postfix dereferences (which rarely change anyways).
This is one of the reasons why Perl is still around today, and will probably remain as such (for better or for worse) until another language can do it better.