At one point, I didn't know Perl and had to work on a project with it.
For a while I was cursing the arcane syntax such as $_, $\ and even $ on a variable to the left of the equal sign...
and then something weird happened. Those things became idioms in my mind and I started achieving a sort of fluency.
And when I started to think in perl, I found it to be the highest-level language I had EVER worked in. I could express myself because there were multiple ways to do something and one always matched what I was thinking.
For example, instead of having to think IF NOT SOMETHING I could UNLESS SOMETHING and then express it as
unless(something) { do_something(); }
or even:
do_something() unless something;
Now I like the idea of regular expressions, but I find the implementation leaves a lot to be desired. or should I say implementations plural.
To me, the main usability problem with regular expressions boils down this: it is hard to distinguish between a literal and a regex control character.
This is exacerbated because regex control characters are usually the same characters other languages treat specially as well.
So you have regular expressions - which are somewhat straightforward, but you have to escape them for the place you are USING the regular expression - perl, shell script, sed, awk, grep or egrep, etc.
So I've used regular expression for decades, and even now it's always subject to a little trial and error and requires testing.
Yep, this. I find it sad even after all these years... I put it down to 2 things - 1) the Perl 6 promise, and 2) Google, who were the new hot startup in Silicon Valley, chose Python...
Anyway... if you’re interested in Perl, especially how to write nice Perl, I encourage you to get yourself a copy of Perl Best Practice by Damian Conway for Christmas
FWIW, the Perl 6 promise was delivered in 2015. Because too many people did not want Perl 6 to be the future or Perl, it was renamed to Raku (https://raku.org using the #rakulang tag on social media). Meanwhile, Perl 7 appears to be the next promise.
Interesting side note here the Tiobe Index, which I know isn't the most accurate measurement of language use and popularity, currently has Perl ranked at 14 up from 20th place last year and is now ranked higher than Ruby and Go.
I didn't. I don't write Perl anymore either, though.
When Python started gaining traction, I was so incredibly turned off by the fans of the language that I swore I would never write code in it. That was 1998. If Python was 10% as good as those people were claiming, it would be humankind's greatest achievement for the next 1000 years, and it isn't.
Please note that I'm not saying anything bad about Python here, only its advocates in the late 1990s. I still have a bad taste in my mouth because of those conversations, over 20 years later.
There was a perl vs python religious war back then that generated a lot of online vitriol. Which made some sense since they were competing for mindshare in the same space. Obviously Python won that war, but it's interesting to think how things would have worked out differentlywithout the self-destructive tragedy that was Perl 6.
That tragedy meanwhile has been renamed to Raku (https://raku.org using the #rakulang tag on social media) and is doing very well. Meanwhile, it appears at least some form of tragedy is continuing with the Perl 7 efforts. :-(
I can understand that, even just a few toxic personalities can poison a community, or even perception of it. To be fair though, there were a lot of Python haters flipping the table over significant white space back then as well.
I made an interesting transition a few years ago, and started using Unicode in my programs.
(1) I have an i18n mapping which provides native support for a lot of helpful characters. Both Mac and Linux use all the keys, so in addition to the half-dozen characters with accents, I have access to a lot more directly. Mac and Linux do remap the remaining keys differently, though.
(2) My code got a lot more readable. Δx is easier to read and more concise than delta_x.
(3) I have a lot more characters to pick from.
A lot of the issues you raise with regexp are due to limits of ASCII.
For more esoteric characters, I do Google and either enter alt codes or cut-and-paste, which might sound like , but remember that you write code once, and read it many times. And editors are increasingly good.
Beyond Unicode, one does have text formats with support for colors, bold, and whatnot, either embedded (escape codes in text) or as syntax highlighting (editor parses).
The CS-level reg exps seem like a good idea. The implementation -- where they're encoded as bizarre ASCII escape sequences -- could use a good revamp.
Oddly enough, I think this is my first HN post where I went beyond ASCII....
Edit: And HN filtered out a bunch of Unicode. It kept only the delta.
For a while I was cursing the arcane syntax such as $_, $\ and even $ on a variable to the left of the equal sign...
and then something weird happened. Those things became idioms in my mind and I started achieving a sort of fluency.
And when I started to think in perl, I found it to be the highest-level language I had EVER worked in. I could express myself because there were multiple ways to do something and one always matched what I was thinking.
For example, instead of having to think IF NOT SOMETHING I could UNLESS SOMETHING and then express it as
or even: Now I like the idea of regular expressions, but I find the implementation leaves a lot to be desired. or should I say implementations plural.To me, the main usability problem with regular expressions boils down this: it is hard to distinguish between a literal and a regex control character.
This is exacerbated because regex control characters are usually the same characters other languages treat specially as well.
So you have regular expressions - which are somewhat straightforward, but you have to escape them for the place you are USING the regular expression - perl, shell script, sed, awk, grep or egrep, etc.
So I've used regular expression for decades, and even now it's always subject to a little trial and error and requires testing.