News for hackers. Stuff that matters.
Re:Next steps for Rust in the kernel by dijit on Wednesday September 21, 2022 @09:01AM (#32924504)
Perl is notorious for being "write only".

As in: keeping it clean and well structured is impossible and the impressive flexibility of the language is huge downside on larger projects.

I feel qualified to say such things as I've worked on a billion-line perl codebase before.

Re:Next steps for Rust in the kernel by belter on Wednesday September 21, 2022 @10:27AM (#32925622)
Shudder in horror.... "Booking.com uses the Perl programming language heavily across its entire technical infrastructure." - https://medium.com/booking-com-development/a-faster-perl-run...
Re:Next steps for Rust in the kernel by klabb3 on Wednesday September 21, 2022 @11:57AM (#32927049)
Dad, let's go home. Please.
Re:Next steps for Rust in the kernel by User23 on Wednesday September 21, 2022 @01:02PM (#32928034)
> Perl is notorious for being "write only".

> As in: keeping it clean and well structured is impossible and the impressive flexibility of the language is huge downside on larger projects.

Perl gets quite unfairly picked on here, to the point where it's basically a meme. It's not like, just to pick a somewhat popular language, Ruby doesn't provide plenty of ways to write completely unreadable code that can only be understand by running it through irb, if even then.

I agree that there is plenty of bad Perl code out there, but there's plenty of bad code in any language that achieves general popularity for a time. Disciplined use can produce perfectly clear and readable code and the module system is perfectly adequate for separation of concerns.

The language does give you an absurd amount of rope to hang yourself with though. If I were managing a large Perl project today I'd have an extremely restrictive style guide and would enforce as much of it as possible via pre-commit hooks.

> I feel qualified to say such things as I've worked on a billion-line perl codebase before.

For a language that permits such densely expressive code, that's appalling. I'm so sorry.

Re:Next steps for Rust in the kernel by singhrac on Wednesday September 21, 2022 @01:08PM (#32928121)
I’ve worked on a Perl codebase written by a good programmer and had the pleasure of starting the port over to Python.

This was surprisingly doable? Marshaling/unmarshaling Perl objects into Python ones isn’t difficult these days, and you can run Perl code via FFI so the transition can be piecemeal.

I have no opinions on Perl as a language (some constructs / patterns felt a bit hard to think about, but I’m far from an expert), but ultimately it’s a high level language and has been left behind tooling wise to another high level language, so it’s time to move. For us, one motivator was that having a large legacy Perl codebase (even one running well for years) hurt recruiting.

Re:Next steps for Rust in the kernel by bogeholm on Wednesday September 21, 2022 @09:07AM (#32924608)
_one billion lines of Perl_? Wow
Re:Next steps for Rust in the kernel by umanwizard on Wednesday September 21, 2022 @09:29AM (#32924872)
I suspect that person worked at Amazon. They at one point had gigantic amounts of Perl before they started slowly replacing it with Java. (I wouldn't be surprised if they still had sizable amounts of Perl in dark corners).
Re:Next steps for Rust in the kernel by Cthulhu_ on Wednesday September 21, 2022 @09:47AM (#32925096)
I can imagine corporate Java codebases can end up in the billion LOC as well. I mean it MIGHT be easier to read, or easier to find developers for...

I feel like - opinion, not based in fact, I've never worked on any codebase >1M LOC - the only way you can keep a codebase like that maintainable is by very strict code style and architecture rules - e.g. no functional programming, no feature X, no feature Y, strict code style rules, strict architecture rules, etc.

Re:Next steps for Rust in the kernel by gautamdivgi on Wednesday September 21, 2022 @10:03AM (#32925310)
Ha ha no. Sorry to disappoint :)

Personal experience. We have some java code from 15-17 yrs back. About the time “design patterns” and all the other “pattern” stuff was big in everyones mind. It’s a mess of abstraction for simple tasks. Couple all that with the fact that class instantiating is possible via reflection and at this point people maintaining it have kinda given up. It works - don’t touch it.

This isn’t an indictment of Java. Just resume driven design.

Re:Next steps for Rust in the kernel by rhacker on Wednesday September 21, 2022 @11:26AM (#32926485)
That's why I left Java 5 years (after like a 12 year career in it) ago and plan on never getting another Java job. It's just making classes have "some" kind of use no matter what the task is, there's no coding to solve problems, it's coding to make structure.
Re:Next steps for Rust in the kernel by gautamdivgi on Wednesday September 21, 2022 @12:03PM (#32927141)
To be fair, I’ve seen this in c++ as well. Building an entire structure of classes like “java” and then using “design patterns” on those abstractions. All to implement a simple 7 step socket communication protocol. It was a “wtf is going on here moment”?
Re:Next steps for Rust in the kernel by rhacker on Thursday September 22, 2022 @04:10PM (#32944002)
I was also part of it. I did my own share of - well if we design it this way then we can have a second "type" that does X with the same interface. And it just keeps on iterating like that. It's still a useful pattern, but often at least in my own case, overused for really trivial stuff.

Programmers are highly trained like to see the world as if everything can be cast the same way. While that IS a good way to see a large variety of software problems, when you isolate down to a companies' use cases, it quickly goes away in the pragmatic sense. It then becomes something the company is paying for because they chose Java and Java developers like that sort of thing.

Re:Next steps for Rust in the kernel by nkozyra on Wednesday September 21, 2022 @09:42AM (#32925036)
There's a spirograph guy in the corner, the only one left that knows perl, lurking out and trying to entice people with its merits.

Long ago I worked primarily in perl and ... yeesh, I recognize maybe 30% of it when looking, and that's the directly-c-adjacent stuff.

To be fair if I walked away from Rust for a year I'd probably be similarly lost.

Re:Next steps for Rust in the kernel by dhosek on Wednesday September 21, 2022 @10:44AM (#32925889)
I still will reach for Perl for the occasional quick one-of text-processing application, but I do spend a lot of time in perldoc when I do.
Re:Next steps for Rust in the kernel by thesuperbigfrog on Wednesday September 21, 2022 @10:46AM (#32925923)
>> I suspect that person worked at Amazon. They at one point had gigantic amounts of Perl before they started slowly replacing it with Java.

The Amazon retail website (amazon.com and related versions for various countries) used the Perl Mason templating system (https://masonbook.houseabsolute.com/) to allow various teams to build web site components in a performant and secure way.

It worked quite well since it ran quickly and isolated components so that only one small change could be made without breaking other components.

Re:Next steps for Rust in the kernel by VyseofArcadia on Wednesday September 21, 2022 @10:29AM (#32925652)
With Java? I usually think of Perl as a glue language, like bash scripting. Java would not be my choice to glue components together.
Re:Next steps for Rust in the kernel by dhosek on Wednesday September 21, 2022 @10:42AM (#32925871)
Nah, Perl can be a perfectly fine applications language. Some things get kind of ugly with it (object-orientation is notoriously hacky and there are two different approaches to classes that take inverse (literally) approaches to how to represent the objects in terms of Perl’s scalars, arrays and maps. It does suffer a bit from being an early mover so there are questionable choices like the fact that library code is traditionally installed system-wide so good luck if application A needs library v3 an application B needs v2 and v2 and v3 have some subtle incompatibility, but Perl is no less capable than Python and arguably more capable than PHP, both of which have plenty of applications written in them.
Re:Next steps for Rust in the kernel by umanwizard on Wednesday September 21, 2022 @11:34AM (#32926593)
Perl was the primary application-layer language at Amazon. It was used for most things that didn't need to be in a low-level language for performance or other reasons (for those, C++ was used instead).
Re:Next steps for Rust in the kernel by twic on Wednesday September 21, 2022 @11:49AM (#32926869)
Could have been worse. Could all have been on one line.
Re:Next steps for Rust in the kernel by LinuxBender on Wednesday September 21, 2022 @10:36AM (#32925785)
I've often found I could work around the "write only" mantra using perltidy. I pass other peoples code to perltidy with the flags that match my style, make changes, then pass it back through perltidy to match the author as close as I can. I try to encourage others to do the same.
Re:Next steps for Rust in the kernel by hardware2win on Wednesday September 21, 2022 @09:37AM (#32924963)
Bilion lines?

What, how?

Thats bigger than windows linux llvm chromium and 5 other compilers combined according to google

Re:Next steps for Rust in the kernel by dijit on Wednesday September 21, 2022 @09:39AM (#32924983)
Commentary on that was made at the time.

Linux is a pretty small codebase compared to most proprietary codebases in large companies to be fair though.

Re:Next steps for Rust in the kernel by angrygoat on Wednesday September 21, 2022 @10:55AM (#32926052)
Yeah, this – it's easy to forget that infrastructure code (Linux, libc, openssl, ...) really is the tip of the iceberg. Industrial codebases are often at least an order of magnitude bigger; really, that shouldn't surprise us: there are so many problems to be solved, it should be unsurprising that the specific outweighs the general.