4 ms·
Bashing Perl is now a meme, but I can never get over what could have been… Python 3000 and Perl 6 had the community all abuzz. CPAN was the amazing Wild West wh
by alfiedotwtf 3y ago
Bashing Perl is now a meme, but I can never get over what could have been… Python 3000 and Perl 6 had the community all abuzz. CPAN was the amazing Wild West where people were sharing amazing libraries in such a simple way compared to how every other language was still using the likes of Source Forge and possibly even Fresh Meat (GitHub didn’t exist yet).
Don’t fall into the meme trap of hating on Perl. Although it’s only now used in a handful of companies run by OGs and possibly by devops, I urge you to take a look and spend a month using it - really using it. .. because it really is a beautiful language and it really makes Stream-of-Conscious programming the norm
- getcrunk 3y agoStream of consciousness programming?
- bane 3y agoPerl has a weird way of letting you go from thought to code, and disappearing in between, unlike any other language I've ever used. You really can go from idea to functioning system as fast as you type without a lot of pre-planning. It's hard to describe, and the style has fallen out of fashion for more formal, easier to share between humans languages like Java or python, which feel like they introduce an inherent friction in that transition layer as a tradeoff for scalable teams and readability. I miss it, but understand why it fell out of favor. It's the closest I've ever gotten to singing whalesong with a machine.
- alfiedotwtf 3y agoExactly this. As fast as you type you're coding. Even though I've now spent years in other languages compared to Perl, it's still stop-start in every other language. I've said it many times, but Perl really moulds to your brain rather than the other way around. You bend Perl how YOU want it.
- eperoumal 3y agoI so much feel the same. At the time I was writing Perl, each line made so much sense, as if I was speaking my mother tongue. It was clearly an extension of my brain. Never had that feeling with any other programming language, and it took me years to eventually let Perl go and try to wrap my head around Python.
- arp242 3y agoI wonder how much Larry Wall's background as a linguist has to do with that, which perhaps also explain some of Perl's "messier" features, just like natural language is kind of messy. I once had a long conversation about this with a linguist and Perl programmer that I randomly met in a pub. However, I was quite drunk and don't really recall too much, and we never saw each other again.
- singingfish 3y agoThis is quite an interesting phenomenon, and kind of explains why perl is disliked so much. Computer programming theory has large swathes of inspiration from theoretical linguistics - think lisp. That's nice for theoreticians because it makes things like parsing easier to think about rigorously. Perl on the other hand, to my knowledge is the only significant programming language to be inspired by practical linguistics, and therefore appeals to concepts like context and ambiguity way more than other languages. This means that a lot of computer scientists academics absolutely hate it, and so it was very much neglected in the education space. The other side effect of this is you still get a good number of talented programmers with backgrounds in the humanities and social sciences who do very well on perl.
- masto 3y agoI love this subthread; I've tried to explain this for years and I've concluded it's simply impossible to convey to someone who never experienced it. It's sad, and really frustrating, to just hear the same clueless comments and memes repeated. So I'm glad to see there are still people around who know what it was like to work with a truly expressive language. About 15 years ago I was put on a Java project that ran for a year with half a dozen developers toiling away (along with an outsourced team that management eventually added to write unit tests). I spent half that time fighting with Eclipse and the other half divided between tearing my hair out trying to wade through the AbstractSpringFactoryInterfaceAbstractFrameworkInjectorAbstractionBuilder nightmare, being lectured at by people who learned everything they know about computers from in-flight magazines that this is the way professional software development is done, waiting for the one person who could actually build the application (which he did partly by unzipping the jar files and manually tweaking their contents), and actually coding. To my complete lack of surprise, the project never achieved a working milestone and was cancelled. What did surprise me was that a coworker who was sympathetic to my grumbling persuaded the CTO who was trying to rescue the project to let me try it my way. On my own (using Perl and PostgreSQL), in a couple of weeks, I had a fully working prototype. We got the green light to proceed and built the company's flagship product on that stack. It was not my brilliant engineering as much as Perl's extraordinary ability to connect mind and machine (coupled of course with my brilliant engineering) that made it possible. I owe Larry Wall for a huge career boost.
- runlaszlorun 3y agoLarge teams themselves become boat anchors towards progress. But you’ve inspired me to spend a little time with Perl.
- alfiedotwtf 3y agoLOL are you me? This is exactly what happened to me! Same situation, Java with an external team, project over budget and over time, gets canned and then a few weeks with Perl and it’s done
- bitwize 3y ago> Perl has a weird way of letting you go from thought to code, and disappearing in between, unlike any other language I've ever used. Funny, a lot of people say that about Lisp...
- singingfish 3y agoAs a medium long time perl guy who's been dragged kicking and screaming to do a bit of python recently I'm going to repeat this here: Python and perl are actually pretty much exactly the same - analogous to the Judean People's Liberation front versus the People's Liberation front of Judea. However the languages are optimised for a slightly different purpose. Python helps you to think more like the computer does, whereas perl helps the computer to think more like you do.
- __s 3y agoThis can be nice in Python. The `dis` module makes execution pretty transparent, & it's easy enough to know what bytecode a given line will compile to (granted, comprehensions creating closures does make that a bit harder) CPython's implementation is also straightforward enough that you can look up ceval.c to get a gist of what an opcode is doing
- gonzus 3y agoI associate this with what we used to call "one-liner programming": I would write a single line of Perl code (in bash, prefixed with `perl -Mwarnings -MDebug -E'<code here>'`, convince myself the code did what we needed, and then share it around as a paste in irc / chat / whatever. It was amazing what you could achieve with the right modules, and Perl's flexibility allowed your mind to roam freely. Incidentally, the fact that you cannot write this type of one-liner in any meaningful way with Python is one reason I do dislike that language.
- fulafel 3y agoAbout Python, are there practical situations outside IRC where you can't include a newline in there? This .. python -c ' import re, sys for line in sys.stdin: print(line.lower().count("foo")) ' works in shell interactively (both bash and zsh support multiline history entries well), or in shell scripts, and also in slack/mattermost/matrix/email.
- teddyh 3y agoYou can do that as a one-liner (I have kept the unused “re” module import, to keep it as close to your code as possible): python -c 'import re, sys; print("\n".join(str(line.lower().count("foo")) for line in sys.stdin))' or if you want to avoid building one large output string: python -c 'import re, sys; print(*(line.lower().count("foo") for line in sys.stdin), sep="\n")' if memory consumption is still an issue: python -c 'import re, sys; set(print(line.lower().count("foo")) for line in sys.stdin)' (This creates a useless Set object and throws it away as a side effect.)
- deleted 3y ago[deleted]
- hnfong 3y agoIt's sad that Perl is dying a slow death. Between Python and Perl, both styles of coding are possible. While Python is my preferred language for most tasks, I still use perl as an ad hoc stream processor with `perl -pe` and nothing really beats it at the task. Anything more than 10 lines and I find python easier to deal with (or at least it's my comfort zone).
- kstenerud 3y agoBashing Perl is a meme precisely because of the mentality of the creators of Perl (who set the culture). This "Forward to Learning Perl" epitomizes the mentality: Imagery of wizards, alchemy, breaking all the stuffy rules that quashed creative thought, etc. He even says "bowing down at the Temple of Orthogonality" like orthogonality a bad thing! It hearkens back to the days when motor cars were curiosities that required frequent tinkering and had no safety requirements. The sky was the limit, but your car could blow up. Perl was rightly bashed because it was the poster child of cowboy coding, which flies in the face of good engineering practices: Understandability, predictability, reproducibility, measurability, safety. This allows you to use a product with confidence. I had the misfortune of inheriting some cowboy code, and to this day I call a pox upon the writer. His lack of discipline caused YEARS of misery and maintenance costs; far outweighing any temporary benefit he provided. Newer programmers might not have lived during the bad old days of cowboy coding, but I did. Nothing was documented. Nothing really worked because there was no edge case support. The mentality was "If it was hard to write, it should be hard to understand" and "If you're not happy with it, feel free to modify the code" (their impenetrable code). Basically, pass-the-buck for your own lack of discipline, and then blame the user. Personally, I'm glad we've moved on towards becoming a serious engineering discipline, complete with UX being a thing.
- alfiedotwtf 3y agoCowboy Coding is not a language thing, it’s a mentality thing. I’ve seen many beautifully crafted Perl projects. “Perl Best Practice” was a thing
- mdavidn 3y agoI'm glad you found a corner of this industry with "serious engineering." It's still the wild west in web development. Today the creators of frameworks chase engagement metrics rather than wizardry, but the end result is the same.
- hnlmorg 3y ago> Perl was rightly bashed because it was the poster child of cowboy coding, which flies in the face of good engineering practices: Understandability, predictability, reproducibility, measurability, safety. That’s the meme, but it’s simply not true. I’m going to use Python as a basis of comparison because that’s the language which, from my perspective at least, seemed to replace Perl. > understandability A lot has been said about sigils but ultimately a language is only as familiar as a developers exposure to it. Python appeared easier to understand for the newbie because it favoured words over expressions but now that Python has matured it’s become just as incomprehensible too. > predictability I’ll be the first to admin that there are a couple of really massive footguns in Perl which are remnants of its evolution as a shell tool. But there’s other aspects to the language which are really clever. For example the way Perl does type comparison is much more predictable then Python. On the whole, I think those languages are about equal. > reproducibility CPAN was also light years ahead anything also available at the time. And still is in many regards. For example, Python environments is a mess. Perl is one of the most portable languages out there. Want to change the state of the runtime? Just add a line to the top of your source. Simple. Python and JavaScript are a completely pain in the arse in comparison. PHP is another example of a language that gets this right. Few people on here (myself included) will have much love for 2010’s PHP but it just goes to show that a lot of the languages “real programmers” praise do actually suck at a lot of the basic principles. > measurability Not really sure what this is intended to refer to. Maybe APMs? Either way, a lot of diagnostics like that came into vogue after Perl’s decline so this isn’t really the fault of the language but more just 3rd party tool writers putting their focus elsewhere. That all said, don’t be fooled into thinking such tooling doesn’t exist for Perl. > safety Perl basically invented unit tests amongst the scripting languages. It also has stricter run modes to differentiate between one time scripts and important business code. Saying Perl lacks safety demonstrates a lack of experience with the language. ——- I’ve written production Perl, PHP, JavaScript, TypeScript, Python, C++, Go, Bash, Visual Basic and even Pascal. De-mangled other people’s spaghetti code in all of those languages too. Probably a few languages I’ve forgotten about too. Perl is one of those languages people love to hate but is, in my opinion, one of the most misunderstood. [edit] I should have added a comment about Perl’s backwards compatibility. Few other languages even come close to the longevity of Perl 5. And that commitment extends down throughout Perl’s ecosystem. With JavaScript I’m constantly scared the next npm update will break the project.
- WesolyKubeczek 3y agoI'm bashing Perl because I'm using it daily today. I have the moral right. People waxing poetic about their time using Perl back in the late 1990s/early 2000s don't have a vote because they clung onto good bits and have long forgotten the ugly. > it really makes Stream-of-Conscious programming the norm Are you sure it's a Good Thing? Really sure? What if you have teammates? What if you have a life? What if you need to revise your stream of consciousness after a year? Still sure?
- alfiedotwtf 3y agoI still use Perl, maybe not daily but yes to weekly, so I have still have skin in the game. Yes I'm sure.
- WesolyKubeczek 3y agoDo you develop with Perl collaboratively with teammates?
- alfiedotwtf 3y agoNot anymore, but I’ve probably worked on the largest Perl code bases in the world, so again… I’m not a Perl noob
- merlynkline 3y agoLast year I finished over a decade on very large Perl project, collaborating within a team. When I joined that project it was already over a decade old a most of the code was much like what you are probably imagining. When I left the project, all the parts we had touched were much like any other high quality modern codebase, and we could almost as readily maintain the decade-old parts (that we had worked on) as the week-old parts. Having worked in many languages over many decades, I've learned that a high quality codebase is built by high quality developers, largely independent of the languages they use. You can build an unmaintainable mess in any language as easily as you can build a high quality codebase in Perl. I would concede that you can more easily build an unmaintainable mess in Perl than in many languages but that's up to you; you can do most things more easily in Perl than in many languages ;)
- forinti 3y agoInteresting this stream of consciousness analogy. I use Perl a lot because it doesn't get in the way. The functional aspect of it lets you map from problem to solution easily.