develooper Front page | perl.perl5.porters | Postings from June 2021

Re: Not an OO RFC, take 2

Thread Previous | Thread Next
Ovid via perl5-porters
June 21, 2021 05:53
Re: Not an OO RFC, take 2
Message ID:
   On Monday, 21 June 2021, 02:34:10 CEST, Yuki Kimoto <> wrote:  
 > Ovid>
> I feel a strong anxiety about you.
> Are you afraid of Perl's death?
More and more we get companies contacting us who are actively purging all Perl from their code bases. Some are well-known companies, some are small, but it's happening widely. Perl is dying. Oh, it will still be around in 20 years time, but at the current rate, it will be some obscure little hobby, maybe running a few legacy Linux tools that we've mostly forgotten about, and it will move on from being your grandparent's language to your great-grandparent's language. 2040: "Perl? Yeah, I heard about it. Does that even compile any more?" Perl will be a curiosity in a technology museum.
Now, I don't want to relitigate the past—that would reopen too many wounds—but we've known about this mess since 2000. That's 21 years ago. 

Recently, on a Facebook Perl group, someone asked (paraphrasing) about how bad a programmer you would have to be if you can't figure out `my ($foo,$bar) = @_;`.
Yeah, so @_ is a wart. Signatures are so useful that I've plenty of clients using them in production systems now. But we still can't have them.
`bless` seems kinda useful, though painful. Another small wart on the language.
People see things like Foo::->bar() and wonder what the heck is that ugliness?
And I must be a rubbish programmer because after decades of working with Perl, I still forget how to get a slice of a hash reference. It's easy, I know. But I forget it.
Calling a function with a leading a ampersand is allowed, but ask the average user what's the difference between &function and &function()? More warts, and pretty important ones.
wantarray and context. Ugh.

SUPER is bound at compile-time and we're stuck with that. Decades of the SUPER bug hanging around our necks.

We have threads, but we're told not to use them. People still do and then stuff breaks.

And we don't get used to nice techniques like inversion of control because we're so used to ignoring encapsulation and using abominations like Sub::Override (I wrote that). It seems that very few people in Perl really "get" OO and developers who get OO probably won't reach for that write-only language we love.

Not one of those things is a language killer in and of itself. All them piled on top of one another, along with many, many other things we could cover, along with a rabid community of users who revel in writing arcane code, means that Perl is not a welcoming language.
But we are stuck with that and we can't break existing code. So where do we want to go from here and how do we get there? Corinna isn't the answer. But I think it (or something like it) is a huge part of the answer.
We have try/catch now. We need exceptions.
We need asynchrony.
We need signatures (damn it!)

We need the beginning of a type system—something useful for humans, not just computers. UInt is great for optimization the sofware, but creating a "Celsius" type for a weather app is great for optimizing the wetware.

We need so many things it's not even funny, but we're not going to get to them unless we change our mindset. Perl 7 was a brilliant idea. This RFC process is also brilliant. There are many more things needed, but this is a good start.
I worked years on Corinna and her design. I opened up the process and had many other people help. That was humbling, seeing all of the mistakes I made, but it's made Corinna even better. I've poured through arcane programming languages, seeing how they handle some of the issues we face. I've read books on OO programming best practices (and find myself envying Java at times). I've juggled various ideas, wrote software to help explore some thoughts, stripped out everything I could to distill a viable MVP. And in various forums (not here, thank goodness), I still keep running into people saying "bless" is all you need!

So that's what's bugging me.
-- IT consulting, training, specializing in Perl, databases, and agile development 
Buy my book! - 

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About