Live data from Hacker News

Perl 7 is going to be Perl 5.32, mostly

perl.com

271–280 of 573 posts

Re: Perl 7 is going to be Perl 5.32, mostly

#271

Earlier quoted context omitted.

Favorite syntactic sugar feature: the /x modifier which makes the regex ignore spaces and comments, meaning you can break your regex into multiple lines and comment them.

Have you ever read O'Reilly's "Mastering Regular Expressions" by Friedl? He does a deep dive into the weird guts of regex modifiers. I was obsessed with that book one summer and wrote a bunch of parsers after learning incremental techniques (/o I think), and then 8 months later I could no longer remember how anything that I wrote worked. Lol me.

Friedl's masterpiece was my introduction to server-side programming in 2000. I'd been doing front-end for a few years with Dreamweaver and I was looking-up it's find & replace features in "Dreamweaver Bible 8" where regexes were mentioned as the ultimate weapon. "Mastering Regular Expressions" was referenced in a footnote and fortunately my local library had a copy. My mind was blown. Regex symbols were just so powerful and the examples were mainly written in Perl which added even more power to them. The book was part of O'Reilly's Perl bookshelf so in addition to Friedl's book I bought the other Perl classics - "Programming Perl", "Perl Cookbook", "Mastering Algorithms with Perl" and "Learning Perl". With CPAN downloaded to my local disk I felt like a hitch-hiker setting out on a journey around the world needing nothing more than Perl in my backpack. Those were the days. Now I have to download 200Mb of node_modules before I can get started.

Re: Perl 7 is going to be Perl 5.32, mostly

#273

Earlier quoted context omitted.

> You learn perl, and you've learned nothing but Larry Wall. Yes, this is why it's nice. You don't have to worship at the foot of an industry which slavishly tries to implement a misunderstanding of a system some dude made up 40 years ago to get around problems in other systems some other dudes made up before that. It's weird on purpose. And it's backwards-compatible-crufty on purpose. Today I can run Perl code writt…

JavaScript probably can, or at least mostly. That's where a lot of its problems come from, historical baggage.

JavaScript didn't exist 25 years ago.

(The first version was released in September 1995, but wasn't JavaScript until Dec 4, 1995.)

Re: Perl 7 is going to be Perl 5.32, mostly

#274
post #101

Earlier quoted context omitted.

Perl definitely has a lot of non-patterned arcana. For instance, $| This variable, if nonzero, will flush the output buffer after every write() or print() function. Normally, it is set to 0. In other languages, you do something like os.stdout.buffered(true) or sys.stdout = io::buffer(sys.stdout) or something like that where you're combining composable pieces: the standard std variable, a standard way of opening files…

I'm no fan of Perl, but you can use $OUTPUT_AUTOFLUSH instead if you "use English;". So this isn't really a Perl language thing; it's a style thing. Other languages can be made to look really bad with poor style. The question then becomes what is culturally accepted, and what is not.

`use English;` as a directive feels like the programming equivalent of someone on TV saying "ye ye ye can you say that in English!?"

Only, it's the programmer saying it this time, not the layman. Perl is a 10x engineer.

Re: Perl 7 is going to be Perl 5.32, mostly

#275

Earlier quoted context omitted.

Perl was my first encounter with regular expressions. To this day, no language I've used does it better and cleaner. This includes Python, Boost/C++, Java, JavaScript, LISP, Go and Rust.

Favorite syntactic sugar feature: the /x modifier which makes the regex ignore spaces and comments, meaning you can break your regex into multiple lines and comment them.

FWIW, this is the default in Raku regular expressions.

Re: Perl 7 is going to be Perl 5.32, mostly

#276
I still use Perl every now and again for powerful one-liners and I'm really glad it's around. Here is a bash function I use which takes args and merges and deduplicates PATH-like expressions:

  merge-args () 
  { 
    perl -e 'print join ":", grep {!$h{$_}++} split ":", join ":", @ARGV' "$@"
  }
And I use as follows:

  export PATH="$(merge-args "${SCRIPT_DIR}"/clang-tidy-ex /usr/local/opt/llvm/bin "${INSTALL_DIR}"/{,samples/}bin "${PATH}")"

  ASAN_OPTIONS="$(merge-args "${ASAN_OPTIONS}" detect_leaks=1 check_initialization_order=1 detect_stack_use_after_return=1 strict_init_order=1 strict_string_checks=1 detect_odr_violation=0)"
I know there are other ways of doing this in other languages and even in bash itself, but to me this is simple and elegant.

Re: Perl 7 is going to be Perl 5.32, mostly

#277
post #265

Earlier quoted context omitted.

> And on top of that, the sigils, refs, and `wantarray` systems means that figuring out what syntax you need to invoke something correctly is confusing mental overhead that you have to keep in mind for every function call That's just badly written libraries that exist in pretty much every ecosystem. By now it seems we have settled that after a couple of args the way to pass multiple arguments is via a hash.

I speak as someone who has programmed in Perl for over 20 years and at one point was the top poster on Perlmonks. The wantarray feature is a problem with Perl, and not libraries. It has nothing to do with how you pass your arguments, but rather how the data comes back. Every single function has to deal with the potential of context. Every choice you make has downsides. The choices made around wantarray tend to age po…

This is why Raku doesn't have contexts in that sense. All a subroutine or method can ever return, is a single object. Such an object can be a List or an Array, but it is still a single value.

Re: Perl 7 is going to be Perl 5.32, mostly

#278

Earlier quoted context omitted.

Because perl improved over time, but they didn't want to break people's existing code needlessly. No-one ever deliberately invents 'senseless' things, we just discover better ways over time. Sure, if we could somehow magically always invent the best way first of all, that would be great. But we can't, so we make the best of what we have, and improve when we can. But there's no need to punish the existing users of old…

The concept of giving functions names spelled out with letters that form words that describe their meaning was invented a long time before Perl figured out that doing that was better than overloading a limited set of ASCII punctuation with random abstract unrelated concepts.

You are going to end up perpetually unhappy if you always assume that people designed things the way they did just because of stupidity / incompetence. Perhaps instead you should take a while to think about the reasons why they might have chosen their design. Even if you can't immediately think of a good reason, doesn't mean there wasn't one.

For this particular case, I'm not sure what drove the selection, but I would guess (since the decision would have been made many decades ago!) it was probably based around perl trying to operate similarly to other command line tools of that era, like awk, sed, (or even ed?), so that people could switch to perl and have a familiar environment? But I don't know, nor have I researched it. In any case, perhaps give the designers the benefit of the doubt before assuming their incompetence?

Re: Perl 7 is going to be Perl 5.32, mostly

#279
post #257

Earlier quoted context omitted.

That certainly doesn't solve the problem of other people showboating their knowledge of obscure Perl sigils by using those ridiculous line-noise abbreviations in code you're trying to use and understand, so you have to look up each bit of obscure punctuation in its particular context in order to understand the code. If hard-to-read-and-remember syntax exists, people WILL use it. And some people will make a POINT to u…

Whatever happened to the neophyte raising him/herself up to level of the master? Programming seems to be the only profession in which the beginner is excused learning the language thoroughly and, worse, that he/she expects the language to be dumbed down to make it easier to learn. Can you imagine a budding musician complaining that musical notation should be made "easier for beginners"? If you want to grok Perl learn…

> Can you imagine a budding musician complaining that musical notation should be made "easier for beginners"?

You mean like string instrument tab coloured by finger instead of sheet music? Yes, exactly like that.

Re: Perl 7 is going to be Perl 5.32, mostly

#280

What is there to gain in calling it Perl 7? It seems needlessly disruptive, rather than just calling it 5.34 or whatever is next.

It's reclaiming the Perl name since Perl 6 has abandoned its connection to Perl and is claiming to be a completely separate unconnected language.

This is the logical conclusion to this divergence and will mean that going forward people wont think Perl 6 is the newest version of Perl. That problem would still exist if you leave Perl at 5.35 since search engines are still happily returning pages for Perl 6 even though it's no longer a thing.

Post reply on HN