Live data from Hacker News

The Joy of Perl (1998)

salon.com

51–60 of 82 posts

Re: The Joy of Perl (1998)

#51
post #36

Earlier quoted context omitted.

No, it isn't the same. I'm no language lawyer, but this is my understanding of it. In python, $foo is a reference. It might be a reference to a scalar value, or list, or hash, etc, but it is a reference. The code you wrote might cause confusion for people who don't understand the python model. In perl, $foo might be a scalar value, or it might be a reference to a value of some kind. Perl has this exact same type of p…

I think OP's point was that even in Python you have to be conscious where your "storage" is--that you're sharing it. Yes, the "Python" model (or Java, JavaScript) of referring to everything by reference is uniform and simple--except it still shares the issue of having to care if you add mutation into the mix. Due to its apparent smoothness it might even make it easier to run into that. In a sense Perl is honest here…

To make my own statement more complete/correct:

> The clean solution for this is functional programming

or another model that guarantees that modifications are never seen by code that isn't explicitly meant to receive them--the prominent other model that's making waves nowadays is of course linear types (and extensions as used by Rust).

Re: The Joy of Perl (1998)

#52
One of the most insightful pieces from the article:

""" "I realized at that point that there was a huge ecological niche between the C language and Unix shells," says Wall.

...

"People are always looking for the interstices," says Wall. "They are always looking for the new ecological niches. And the speed with which you can move into those ecological niches is really important, because the first person into a niche is often the winner." """

Re: The Joy of Perl (1998)

#54
post #19

Used to spend a ton of time writing Perl (see username). Moved on to better designed languages. Which are not hard to find. There are a few big issues with Perl 5 but the biggest is easily the mess of references vs flat values. Python, Ruby, JavaScript and many other dynamic languages do not make the programmer think about whether you are going to pass a data structure like an array or hash as a reference or direct v…

I once did a lot of Perl too, and I agree that Perl has many design flaws, but I prefer it this way. The main reason is if the same array is contained inside two different data structures, I want this to be explicitly obvious in the syntax of the language.

For example:

    my $a = [10, 20, 30];
    my $b = { array => $a };
    my $c = { array => $a };
    $b->{array}[0] = 99;
    print $c->{array}[0];
To me, anything the syntax can do to make it clear that the above code prints "99" (and not "10") is a net win. I don't care how cluttered it looks or how much extra typing it requires. If a language hides this from me in the name of cleanliness, then it's creating a leaky abstraction that is going to cause bugs and other forms of suffering.

If you're in a language which has immutable arrays, then this doesn't matter. But Perl isn't that, so that's not really relevant here.

To me, languages that add reference types (like C++'s) or language features that allow passing things by reference just create an extra cognitive burden. I look at some code and wonder, "Is this going to have ripple effects in distant places?", and I have to work through some rule in my head such as, if it's an integer, then no, but if it's an array, then yes.

Contrast that with the Perl (or C) way. I look at some code and the syntax tells me. There's no mistaking what's going on. So less cognitive burden and less opportunity for error.

Re: The Joy of Perl (1998)

#55
The thing about perl I still miss is the metaprogramming. It's really amazing to be able to launch a program that writes the "last mile" of code before it starts taking requests.

Re: The Joy of Perl (1998)

#56

It soothes me to read that even back in 1998, people were criticizing Perl for being write only and were considering Python. Trends in programming seem a little slower, knowing that.

In that time period I remember it being very common to hear Python introduced in conversation as a perl alternative. That was how I first heard of it too.

Re: The Joy of Perl (1998)

#57
post #55

The thing about perl I still miss is the metaprogramming. It's really amazing to be able to launch a program that writes the "last mile" of code before it starts taking requests.

Then perhaps Raku is a thing for you, with its Metaobject Protocol: https://docs.raku.org/language/mop

Re: The Joy of Perl (1998)

#58
post #43

If perl6 had not been the Duke Nukem Forever of programming languages, I'd probably still be coding in Perl, but Ruby just came along and offered a very similaly spirited playground. And then I found lisp and realized that my late perl code was very lisp-ish anyway.

Did Duke Nukem Forever change its name? Perl 6 has. It's called Raku now (https://raku.org using the #rakulang tag on social media). And it is very much alive and ready for production.

Re: The Joy of Perl (1998)

#59
post #55

The thing about perl I still miss is the metaprogramming. It's really amazing to be able to launch a program that writes the "last mile" of code before it starts taking requests.

You can do a lot in Perl with just closures and setting package slots etc., that you would need to use macros for in say Lisps.

Still, I agree, there's no real AST and string eval is unsafe and parsing is a real issue. I've started https://metacpan.org/pod/FP::AST::Perl (very unfinished) to solve the code generation issue and hope to generate an AST from the op tree (not sure how feasible, will see). Feel free to tell me (here or offline) what your use case is and whether that module might suit you.

Re: The Joy of Perl (1998)

#60

I still write Perl to this day on my personal projects and try to contribute as much as I can to CPAN. After more than 10 years it’s still my go to language. I think a lot of people are afraid of learning Perl just because they heard is hard to write or they came across some horrible code, I believe PHP suffered from this not so long ago. If you want a taste of using a really good web framework have a look at Mojolic…

> I still write Perl to this day

I do too. I use it for solving data-analysis problems in a portable and long-stable way. To this day, I can still run Perl that I wrote a long time ago. That's a good investment. I can build data structures in Perl OO that are much more efficient in memory consumption than other interpreted languages.

Good code and bad code exist in every language -- anyone who has been in the business for a while knows this.

I would just add that the rejection of sigils and braces is also the rejection of other very useful and efficient tooling, such as bash and awk.

Post reply on HN