News for hackers. Stuff that matters.
Re:Why Perl? by jjgreen on Monday June 12, 2023 @05:21AM (#36290569)
In my dreams Python has the stability of Perl, then I'm woken by an alarm that a Python script I wrote 6 months ago uses a now-deprecated feature ...
Re:Why Perl? by dmz73 on Monday June 12, 2023 @05:37AM (#36290716)
I wanted to like Python. Every time I tried to use/learn it, the "program" I wanted to use had some issue. The very first one (some 15 years ago) depended on mutually incompatible libraries so I had to spend time not only learning Python but fixing the libraries to work together. Next one was a dlna server that managed to use up all 4GB RAM available on my NAS and make the whole system unusable. Then there was a "compiler" that worked on all OS-es except that on Windows it would 100% not work due to some path string handling when starting a process. How do you even get to that point...that could have never worked on Windows and it's not like Windows is some marginal never used system so no testing was required. Then I tried to write a simple script to transfer some emails via IMAP...and Python idea of supporting IMAP is for me to read the RFC and build the correct string to sent to IMAP server...WTF???? That is the assembler lever of "support" of something. I did try to do that and then I ended up with multiple pages of something that looked like level of arcade game with climbing hills and cliffs of code where it was hard to tell if code was meant to end or if someone got bored of writing and just gave up. I hate Python.
Re:Why Perl? by anthk on Monday June 12, 2023 @03:57PM (#36300038)
Heh. On Python and IMAP, getmail was dog slow against isync/mbsync. Same RAM issues.
Re:Why Perl? by andrewstuart on Monday June 12, 2023 @05:26AM (#36290620)
This is a new one on me …. Python is unstable?
Re:Why Perl? by t8sr on Monday June 12, 2023 @05:33AM (#36290685)
Very much so, insofar as code written a few years ago probably doesn’t work anymore. Some of that comes down to libraries not being careful about versioning, but a lot of it is the language itself making seemingly random changes in direction every few years.

10 years ago: range 5 years ago: xrange Today: range again, LOL!

I don’t know of any tech companies using Python for anything serious anymore, except data/ML analysis, which is usually not too much code. If you make me rewrite the thing, it’s getting rewrote in Go or Rust, not Python again.

Re:Why Perl? by Roark66 on Monday June 12, 2023 @05:41AM (#36290752)
How about a fortune 300 company I consulted for that uses python pretty much exclusively for the deployment processes of their 200+ web/cloud apps? Some of those apps have 1 VM plus a DB and a dozen users. Some have environments that cost £30k a month and 5k users. Python is the only language used for CI/CD. Plus power shell for stuff that needs windows server.

70% is python 2, 30% written/rewritten recently is python 3.

Re:Why Perl? by josefx on Monday June 12, 2023 @06:12AM (#36291069)
> 70% is python 2

I hope they are paying for security updates since python 2 has hit EOL 3 years ago and libraries had been actively shamed if they didn't drop support for it long before that.

Re:Why Perl? by Roark66 on Tuesday June 13, 2023 @02:22AM (#36306259)
Nope, not for python 2, but there was tracking of published vulnerabilities. None that were discovered during my time there affected existing python 2 code.

Python 2 code is being transitioned to 3 and there is a plan to do so for all of it, but it's definitely not a highest priority task. Usually done when new features are requested.

This isn't ideal, but it's not a reason to panic. None of the code is externally facing, none of it accepts user input directly beyond a press of a button in third party software that triggers it. All it does is pretty simple stuff. Infrastructure provisioning etc.

Re:Why Perl? by andrewstuart on Monday June 12, 2023 @05:39AM (#36290737)
Maybe Perl is stable cause its dead.
Re:Why Perl? by meepmorp on Monday June 12, 2023 @05:52AM (#36290853)
Latin and Sanskrit are stable af.
Re:Why Perl? by jjgreen on Monday June 12, 2023 @05:59AM (#36290922)
Latin is pretty stable, but not entirely fixed: https://www.nytimes.com/2003/05/14/world/vatican-introduces-...
Re:Why Perl? by drewcoo on Monday June 12, 2023 @11:57AM (#36295648)
I took a medieval Latin course in college that was especially challenging because after the empire fell, Latin was absolutely not stable.
Re:Why Perl? by smcl on Monday June 12, 2023 @05:44AM (#36290784)
The criticism is that the Python team will deprecate and remove functionality as it's not needed? Boy, you're gonna hate PEP-594.

Also Python 2->3 transition was a one-time thing that developers had over a decade to perform, it may have been painful for some but saying it's a random thing that happens "every few years" is a bit dishonest.

Re:Why Perl? by fullspectrumdev on Monday June 12, 2023 @12:06PM (#36295774)
PEP-594 is actually causing me some anxiety - I deal with a good amount of code that uses some of those “batteries to be removed”.

Some of them (telnetlib) I can vendor in, but I wonder how many people who use them will be caught pantsless?

Re:Why Perl? by smcl on Tuesday June 13, 2023 @04:09AM (#36307128)
I reckon if you're the sort of org who will update the Python version you use, you're going to be switched on enough to handle this somehow. I don't use any of these "dead" batteries though, so I can't speak with any authority on the matter
Re:Why Perl? by stonogo on Monday June 12, 2023 @12:18PM (#36295986)
Are you saying there will never be a Python 4, or are you saying that the 2->3 transition was so badly flubbed nobody will make that mistake again?
Re:Why Perl? by smcl on Tuesday June 13, 2023 @04:20AM (#36307211)
Well yeah given that some people are still talking about issues from a software release that happened 15 years ago, it would be incredibly unlikely that they'd want to repeat that.

What has me a little bit confused is that we're in a thread talking about how Python somehow "flubbed" after 2->3, despite an explosion in popularity during that period culminating in it being arguably the most popular programming language around. And the counterexample is supposed to be Perl, a language which I have enjoyed using but which has fallen off a cliff during the same period, and which has had an even more enormous and self-defeating flub (Perl 6 aka "Raku").

As I said, I understand if Python 3.x was painful for some organizations. I think the suggestion that it was a failure and that Perl showed us the right way to go is a pretty silly one though.

Re:Why Perl? by lizmat on Tuesday June 13, 2023 @06:55AM (#36308299)
Saying that the Raku Programming Language is a flub, indicates to me that you do not know it at all. Getting Unicode support right by itself should be an indication that it is better than Python 3 in that respect. And let's not start about the fact that the Raku Programming Language does not have a GIL, allowing true multi-processing features and event handling.

https://raku.org

Re:Why Perl? by smcl on Tuesday June 13, 2023 @07:34AM (#36308642)
In terms of execution the development and release of Perl 6 was undeniably a flub. What eventually got released was ultimately a fine language, but it was years late, largely incompatible with existing Perl code (hence the rename) and a sizeable portion of what was left of the Perl community didn't adopt it and stayed on Perl 5.x. Sizeable enough that there are now some rumblings around tidying 5.x up a bit and releasing it as Perl 7.
Re:Why Perl? by telmo on Monday June 12, 2023 @05:51AM (#36290844)
> I don’t know of any tech companies using Python for anything serious anymore, except data/ML analysis, which is usually not too much code. If you make me rewrite the thing, it’s getting rewrote in Go or Rust, not Python again.

It is weirdly comforting to observe how certain things never change over the years, even in tech. One of them is the hyperboles people deploy when attacking programming languages that they do not like: "I don’t know of any tech companies using Python for anything serious anymore". I mean, except for being the 4th most popular language amongst professional according to last year's Stack Overflow survey. Only JavaScript, SQL and HTML/CSS are more popular. Yes, yes, I am sure it is dying... any moment now.

Re:Why Perl? by t8sr on Monday June 12, 2023 @06:27AM (#36291206)
You just read what you want to read, friend. I don’t particularly dislike Python, in fact I wrote about 50k lines of it a few years ago.

My claim is that the big names don’t really use Python outside of data pipelines. Where I’ve worked (including an org that had had Guido on it for a while) usually had guidance saying “no new Python projects”. You can ask people at Google, Meta, etc when was the last time they wrote production Python code if you don’t believe me.

That’s not mutually exclusive with web devs on Stack Overflow using the language, nor does it take away from its success in academia.

Re:Why Perl? by raverbashing on Monday June 12, 2023 @05:56AM (#36290891)
> it’s getting rewrote in Go or Rust, not Python again.

Have you ever tried to recompile 1 yr old code in Rust with the latest compiler?

Re:Why Perl? by orwin on Monday June 12, 2023 @07:52AM (#36292014)
Why wouldn't you tag your 1 year old code with the compiler it was written for?

And same question for grandparents. I'm not a great dev, average at best, but at least I control my systems.

Re:Why Perl? by stonogo on Monday June 12, 2023 @12:20PM (#36296022)
If that's what best practices are for these languages, I now better understand my collegues who will not move away from C/C++. Having to identify a specific compiler version for each bit of code sounds like a nightmare.
Re:Why Perl? by zkldi on Monday June 12, 2023 @12:55PM (#36296709)
it's very easy. you make a file called `rust-toolchain` next to your `Cargo.toml` that contains the version of rust you intend this to compile for.

It will then compile for that version.

Re:Why Perl? by bamfly on Monday June 12, 2023 @04:14PM (#36300315)
C and C++ projects of any notably complexity & size often suffer from those exact same kind of "library or build tool or compiler updated—now the project won't build" problems. Absent some pretty heroic & unusual levels of discipline from all involved, anyway (which is also a way to avoid those issues in most other languages that have them).

[EDIT] Check out issue trackers for such projects, some time. "Build broke due to [thing] being too new" is a routine issue to encounter.

Re:Why Perl? by gkbrk on Monday June 12, 2023 @01:19PM (#36297217)
Why should you need to? Just use a stable language, or a language that has a standard or a specification.
Re:Why Perl? by chlorion on Monday June 12, 2023 @11:07PM (#36304660)
Rust is a stable language.

Stable features will never be removed or broken. If you don't use unstable features, and aren't relying on something that is unsound, your code will continue to compile. If it doesn't, this is considered a bug and should be reported.

This isn't just a hollow promise either, they run tests against most of the crates on crates.io when making changes to the language to ensure that old code is not accidentally broken.

Claiming that rust isn't a stable language is pure misinformation, but sadly not uncommon.

It's also worth noting that some of the language is specified informally, this is the "reference", there are also RFCs for new features that describe exactly how the feature is intended to work. This isn't a complete formal specification, and could use a lot of work, but I don't think a formal specification with a committee is any better than an informal reference, assuming the reference is exhaustive!

Re:Why Perl? by cesarb on Monday June 12, 2023 @04:35PM (#36300651)
> Have you ever tried to recompile 1 yr old code in Rust with the latest compiler?

I have, more than once; it worked perfectly fine.

The only time it's broken for me is when the code had unstable nightly-only features, hidden behind a "nightly-only" feature flag, which was rejected by the parser on a newer Rust compiler, even though it would not be compiled due to the feature flag being disabled (even though it wouldn't be compiled, it still had to be parsed; IIRC, it was the change to the inline assembly syntax, and the fix was just to change from "asm" to "llvm_asm").

Re:Why Perl? by raverbashing on Tuesday June 13, 2023 @12:42AM (#36305419)
Not my experience, though I think it was more due to libraries (but need to update a library -> needs newer compiler version -> needs to update another library, etc)
Re:Why Perl? by BeetleB on Monday June 12, 2023 @12:55PM (#36296706)
> but a lot of it is the language itself making seemingly random changes in direction every few years.

Outside of 2 -> 3, I can recall only one or two instances of dealing with this in the last 15 years. One was the introduction of "with" and "as" as a keyword. The other one I can't even remember.

None of the code I have written on my personal PC in all these years needed modification due to these changes (all of them were in 3rd party code I needed to patch). I still have Python 2 scripts continually running! I have Python 3.10 installed, and never had to fix a broken script of mine since I switched to Python 3 several years ago.

> 10 years ago: range 5 years ago: xrange Today: range again, LOL!

Eh? When I began using it heavily (before Python 3 existed), both range and xrange were heavily in use - one was a list the other was a generator. Since Python 3 has been stable and fast (circa 2013 or 2014), it's been only range.

Re:Why Perl? by rcarmo on Monday June 12, 2023 @01:28PM (#36297403)
This goes against my own experience. I moved from Perl 4 to 5 and from Python 2.x to 3.x and have dozens of projects written in Python that have been constantly updated over the past 10 years, none of which broke due to those things - and they are not all in the ML space.

Your sample size of one needs expanding.

Re:Why Perl? by nerdponx on Monday June 12, 2023 @01:34PM (#36297534)
> Very much so, insofar as code written a few years ago probably doesn’t work anymore.

Citation needed? Just a week ago I used a Python library completely unchanged from 2013.

> Some of that comes down to libraries not being careful about versioning, but a lot of it is the language itself making seemingly random changes in direction every few years.

"Seemingly random" is both wrong and insulting. The BDFL did step down and was replaced with a steering council, so maybe that's what you're seeing. I do agree that `match` was a bad addition to the language, but that's one small example among many supporting the opposite opinion.

> 10 years ago: range 5 years ago: xrange Today: range again, LOL!

Huh? Python 3.x has only ever had range(), so it's been range() for at least 10 years.

Re:Why Perl? by jjgreen on Monday June 12, 2023 @05:37AM (#36290713)
Clearly an example of a parallel universe leaking into my own, can I come and live in yours? Please?
Re:Why Perl? by qsort on Monday June 12, 2023 @05:33AM (#36290682)
It's certainly less stable and ubiquitous than Perl. These days I'd rather be on Python (better libs, doesn't spook colleagues, very common on Linux boxes), but it's not an unreasonable position.
Re:Why Perl? by KaiserPro on Monday June 12, 2023 @05:59AM (#36290926)
One of the things that I noticed when I started python (many many years ago) is that it crashed a lot more than perl.

perl you really had to properly abuse it to make it actually crash.

Now, some people see that as a feature not a bug (for either perl or python's behaviour)

Re:Why Perl? by kdklol on Monday June 12, 2023 @06:32AM (#36291252)
Can confirm, recently written scripts require modification pretty much every minor version. Take the limit on the default size of BigInts now. Why? Just... why? I had to look into every script add the override line at the top (or check the entire script it ever assumes unlimited BigInt anywhere). No wonder there are still Python 2 scripts in use.
Re:Why Perl? by Hamuko on Monday June 12, 2023 @05:48AM (#36290818)
Deprecation doesn't really mean that your script is broken or going to break anytime soon. unittest.UnitTest.assertEquals() has been deprecated since 2011-02 (Python 3.2) and is set to be actually removed 2023-10 (Python 3.12).
Re:Why Perl? by jjgreen on Monday June 12, 2023 @05:54AM (#36290870)
Not always, but for the sake of your sanity you need to fix those deprecations, if only so you can see the new ones, one of which will break your script at some point.
Re:Why Perl? by tokai on Monday June 12, 2023 @10:20AM (#36293883)
What? The Perl 6 debacle has gone down even worse than Python 3.
Re:Why Perl? by G3rn0ti on Monday June 12, 2023 @11:24AM (#36295115)
Perl 6 took longer than expected but „Raku“ is alive and well. It even moved into the Tiobe-Index at rank #48 recently:

https://www.tiobe.com/tiobe-index/

This whole Python/Perl competition was always a bit silly. Both languages had and have their place. I would say Python is so much more popular because it found a niche in ML because of how much more easy it is in Python to interface fast C modules. So you get to write simple Python programs leveraging blazingly fast math libraries. That was always a bit more tricky to do in Perl.

But Python as a language is definitely not as flexible as Perl 5. Last time I checked Python didn’t even support multi-line lambdas because its inventor hates those. Python is very much designed in a top-down approach and tries to guide all Python programmers into how there are supposed to solve their problems. Perl 5 was designed with its famous „easy things should be easy, hard problems possible to solve” philosophy. It allows for meta-programming in all the right places which a seasoned Perl developer can reach to when necessary. Perl 5 is a nice middle way between C and Lisp.

That being said modern JavaScript turned into a powerful language that fits well into both the frontend and backend side of a web application nowadays and, hence, kind of replaced Perl as glue language for the web. It will also push Python out of web backends at some point I believe.

Re:Why Perl? by achileas on Monday June 12, 2023 @03:08PM (#36299300)
Having used Python and Perl professionally, I'd have to agree with really all of this. I just want to emphasize Python's niche in ML (since that's what I do with it mostly lately) - it was also helped by a large, early set of libraries specifically for ML that other languages either still don't have or are playing catch-up (Elixir), and its ease of use among academics, a lot of whom went straight from academia to industry.
Re:Why Perl? by b1c837696ba28b on Monday June 12, 2023 @11:48AM (#36295485)
Really? Was Perl 5 deprecated with prejudice across ecosystems, forcing projects to work with a janky, still-evolving replacement well ahead of production-grade stability? Because the boot marks in my ass from the forced march to Py3 are still bleeding.
Re:Why Perl? by wwweston on Monday June 12, 2023 @12:20PM (#36296019)
Perl 5 has been usable and improved on continuously over the last 20+ years.

Raku / Perl 6 has been the R&D project it set out to be with interesting new features and smoothed out syntax.

You can use either freely as meets your needs. If there's a "debacle" here it's the misunderstanding.

Re:Why Perl? by Woodi on Tuesday June 13, 2023 @09:15AM (#36309803)
What ? First Perl6 wasn't meant as replacement for Perl 5, v5 was meant to stay forever, maybe to be improved when possible. And that we have.

Perl 6 was meant as the bravest experiment with C-like syntax in 30(?) years - attempt to nicely mix few programming paradigms and styles. And that we really have in Raku.

They was talking "Perl is dead" but it never was and isn't. Maybe it looked as clinically death with out of body experience into ideal language heavens but since decade or so it is back. Solid and backward compatible as always.

And there was problem for some with "parallel language versions" marketing so Perl 6 was renamed to Raku. The harder question was "Which one I need to learn ?", but it is newbie programmer question, you need to know many languages because it is standard programmer life experience. And it is XXI century and many technologies are around.

On the other hand Python usage is scientifically researched as being a "write abandonware" language :)

Re:Why Perl? by lizmat on Tuesday June 13, 2023 @09:25AM (#36309908)
> Perl6 wasn't meant as replacement for Perl 5, v5 was meant to stay forever, maybe to be improved when possible. And that we have.

Sorry, but originally it was meant as the replacement (and I was physically present at its announcement at OSCON in 2000). It wasn't until 2008 when the "sister language meme" was generally accepted, that the paths diverged instead of being sequential.

Re:Why Perl? by Woodi on Wednesday June 14, 2023 @01:41AM (#36321884)
Ok, Perl6 was meant as new lang version. And replacement.

Ok, multi-lang virtual machines wanted to replace Perl5 binary.

But: :)

- multi-lang vm's are proof that v5 syntax wasn't mean to be eradicate at all cost

- there was no plan or push to instantly obsolote, uninstall and deny of Perl 5 usage

- I'm sure there was a conviction that some Perl 5 installations will stay for long time period into the future. Or as long as possible ~~ forever.

So it wasn't like Python 2.7 replacement. And plans even assumed continuation. And some from the start wanted to have both langs :)

Re:Why Perl? by lizmat on Monday June 19, 2023 @07:51AM (#36389960)
Indeed. The original plan envisioned Perl being a slang in the Raku Programming Language. That plan failed because Perl is largely dependent on C-code plugins that are used whenever Perl is considered to be too slow (which is often). So being able to support Perl syntax in Raku, would only allow use of Perl-only modules from CPAN (of which there are way too few).

To counter that, Inline::Perl5 (https://raku.land/cpan:NINE/Inline::Perl5) was developed. It gives you access to 99.9% of Perl's functionality transparently, such as being able to subclass Perl classes in Raku, and vice-versa.

Re:Why Perl? by nerdponx on Monday June 12, 2023 @01:37PM (#36297618)
Which feature? Deprecation warnings tend to be in place for several years before removal. There's a formal policy for it: https://peps.python.org/pep-0387/

> Unless it is going through the deprecation process below, the behavior of an API must not change in an incompatible fashion between any two consecutive releases. Python’s yearly release process (PEP 602) means that the deprecation period must last at least two years.

In practice, it's usually longer than two years, except on features that were considered provisional in the first place.