Perl was a great language design lab experiment. They gave people 20 ways to do any simple thing, and then Matz and Guido looked to see which ways became popular and designed great languages that allow only those ways and maybe 1-2 more that are highly frowned upon. I'm almost as glad Perl exists as I am that I never needed to learn it.
Lisp is also undecidable simply because the body of a (defmacro ...) form can do anything, including getting into a loop and not terminating.
Programming in general is undecidable even if the compiling of the language isn't. Whether or not a program gets to the executable stage may be decidable in some language, but whether that program terminates and calculates the correct result isn't. (So what good is the first order decidability, at the end of the day.)
In practice, building everyday, run of the mill programs terminates in a reasonable time. The undecidability means that the time isn't guaranteed; we must be prepared to wait arbitrarily long for a compilation, and to forcibly terminate it it we feel that it seems like it won't complete. And when we do that, we have no proof that it wouldn't have completed. But, so what; if a file that should take seconds to compile takes 15 minutes (i.e. that particular case is decidable), we still regard that as a problem. Why on Earth is it taking 15 minutes? Either something is wrong, or we have to adjust our expectation for that file.
I will say that Lisp macros are more obviously undecidable than some of the other things here, because they're obviously arbitrary Lisp code. It isn't a surprise when someone says that a Lisp function could loop forever.
I don't think the language design influence of Perl on Python was as strong as you imply.
I think the influence was mainly in Guido looking at Perl and realizing he wanted a language that didn't look like that.
I'm pretty sure the Guido has said that ALGOL 68 and Pascal was probably the biggest positive outside influences (together with some in-house language called ABC that he was using at the time)
When you say "that didn't look like that", are you presenting a conjecture? There was only a few years between the first release of Perl and the start of Python.
Going off on a tangent: I dislike standard sluggification algorithms; they’re far too fond of throwing away useful parts of the title, like small words in some or turning C++ into just c in almost all cases. parsing-c-is-literally-undecidable would be so much better as parsing-c++-is-literally-undecidable (but note that Amazon S3’s HTTP server has a broken implementation of + in file names that they refuse to fix; with that exception, using + in the URL is perfectly safe everywhere I know of) or even parsing-cpp-is-literally-undecidable (you might choose this manually) or parsing-c-plus-plus-is-literally-undecidable (a sluggifier might produce this).
ruby did not go the python way and have only have a couple ways to solve a problem. There may not be quite as many ways to solve something as perl allows but it's still allows for a lot of options.
For the people out there that's not so into CS, and does not understands it's implications. It basically means you could write a perl program that could cause an infinite loop in the interpreter (or compiler). This I would presume independant of the actual implementation of the compiler and intrepreter as that would only mean this is a bug report for the specific implementation, and not a problem with the language design.
These are an expounding upon this link. In most languages, you can at least tell what things are. This is a function. That's a variable. In perl, there are constructs whose parsing depend on what a given bit of code was defined as previously, and that definition can be predicated on code execution. This leaves you in a situation where you cannot tell if something is a division and comment or a regex without knowing whether a function takes arguments. ( see link )
If you can't in general parse a piece of perl without "running the program" as you yourself mentioned then I'm pretty sure that parsing it can definitely trigger infinite loops as perl language is definitely turing complete during run time. So your statement is a contradiction.
The comment said you won't cause an infinite loop during parsing due to a bug in the language definition, not that you can't do so at all. Perl lets you run arbitrary code during parsing, so of course it's possible to run an infinite loop while parsing. But you can only do that by actually writing an infinite loop in your code, not by writing something that confuses the parser into looping forever.
Actually the problem has more implications, as it's an effect of parsing the code. Any IDE:s that have advanced features that rely on parsing and analysis of the code can be caught in an infinite loop and stop responding.
The sad part is, in the general case it's impossible for the parser (or any other process overviewing it) to decide if it's actually caught in an infinite loop or not, that's why they call it undecidability.
In theory, yes. Of course in practice, it's not so bad: they can run the parser in a different thread, they can put hard limits on how long they run, etc.
(The hard limit is how C++ gets parsed, I think. Since parsing C++ is also undecidable thanks to weird interactions with template metaprogramming.)
For simpler languages you can implement logic in the editor / IDE for things like precise autocomplete and parsing.
For C++ even precise syntax colouring would be undecidable---and just hard to get the logic right. There are two ways out: (1) implement an approximation and the occasional impression, (2) ask the compiler for help. I think the llvm project helps with the latter.
(What does emacs have to do with things? Or do you mean you are using emacs without any special support for C++? With the right modes you can turn your emacs (or vim etc) into basically a fully fledged IDE.)
Perl is awesome. I bring in 90k+ a year making a living on perl while only working remotely ( and living in a small city where the avg household income is <$50k year).
Honestly, the only reason python "won" was because google picked it up for internal use (and that was only because of the perl5/6 debacle since why pick perl5 since 6 would be coming out by next Christmas?)
As far as "undecidable", its a feature and one of the reasons why it still remains faster than most other dynamic scripting languages.
IMHO, Perl was hurt more by its sigils than the protracted P6 development. There was a lot of revulsion to sprinkling your code liberally with $, @, and %. Many many comments about writing unreadable line noise when programming Perl.
Python's genius was to force programmers to indent their code, making sure it had at least a modicum of structure.
I still don't understand that revulsion. Yeah, it looks "ugly", maybe (a valid but very subjective opinion), but it also makes it obvious that something is a variable and - specifically - whether that variable is singular or plural at a given moment.
The "Perl is indistinguishable from line noise" meme came about from folks equating JAPH-style Perl Golf one-liners with all of Perl. It had very little to do with the use of sigils specifically; such "line noise" is perfectly possible in Ruby and Python.
If anything specific to Perl contributed to the "Perl is line noise" meme, it's probably the fact that a bunch of special variables have names consisting of punctuation marks. Nothing stopping the programmer from doing a "use English;", though.
[not trying to hijack the discussion, but I think a meta-discussion is in order based on comments I've seen on this article]
The article is about whether or not you can actually parse Perl without running Perl to parse itself. One of the benefits/drawbacks to Perl is that it lets you run the interpreter at compile time, thus resulting in the possibility of an infinite loop preventing compilation. Which makes some people unhappy.
Oddly enough, this reminds me of the whole strongly/weakly typed discussion, with people weighing in and asserting one position or another, without really adequately comprehending the opposing position.
The meta-discussion here repeats almost every other discussion of Perl I see on HN and elsewhere. First there is a claim of death, either in the past, or present. Then there are claims that death was by sigil, line noise, etc. Further, additional claims are that other tools have taken over its space.
The data used as evidence are StackOverflow analyses, or Tiobe scores, or, insert additional popular, and often self-selected, data sets. You have to make specific assumptions about some of the data presented to be able to accept it, such that each community has about the same rate of people searching for answers on SO, or other places. Or that the searches will have relevant terms in the in each case.
This is a stretch to put it mildly. If I google for DBIx::Simple, and this search is caught by one of these filters, will it show up in Perl or not? I can't actually answer this. I have to refer to what the collectors of the data say on their own methodology [1][2]. I am not saying that there are not secular changes throughout the industry, or that various observed gross trends are "wrong". What I am saying is be careful reading into these analyses too strongly, as they may not be measuring what you think they are measuring.
In many cases, over the last 20 years or so, I've seen folks pushing Python happily talking up why they left or abhor Perl, usually saying/quoting things they've heard. From my own experience, Perl 4 and onward, much of what they complain about was Perl 4 or before. Likely before many of them started programming. That is speculation on my part, but it does appear to fit what I've observed.
If I extend this out to operating systems, I have people tell me how horrible Linux is and how much better anything-other-than-linux is than it on a very regular basis. They like to list (what they perceive to be) the faults, quote SO and other random websites as examples, and often make pronouncements not backed up by objective fact ... in many cases contradicted by objective fact.
We as a society of technologists seem to like our tools to the point where we feel that we can and should break into tribes with tags of honor around our necks, and nasty comments about alternative tools, and users of said tools. I've personally heard many an anecdote and critique of various tools from otherwise smart technologists that were, at best, badly misinformed, and at worst ... not simply disingenuous, but dishonest.
Look, it is great you like your tools, your operating system, your language. It does not mean that you are "better" or "smarter" than someone else because you use such things. And yes, I've had professional discussions as recently as last week on exactly this issue. Which is insane.
Maybe I've spent too many years on the business side, as I look at all of these things as tools to accomplish a goal, and as engineers, our jobs are to select the right combination of tools to a) minimize effort, b) maximize the possibility of success, c) enable debugging, observability, supportability.
No single tool, OS, editor (yes, I went there) has this. Moreover, if you need to bash what someone else is using simply for self gratification, then there are deeper issues afoot than simply a technological consideration.
Finally, I've been a user of Perl, and contributor to (CPAN) for more 20 years. Rumors of its demise, are greatly exaggerated. It is not my be-all/end-all language ... I am comfortable and competent in 5-6 at any one time, and can easily work in Python, C, Julia, Node, etc. w/o major issue (though with google nearby for things I don't have on the tip of my memory).
I don't use Perl for machine learning (though I could). I don't use it for numerics (though, again, I could). I don't use node for either of these. You pick the right tool for the right job. And you need to keep an open mind throughout the process on what the right tool is.
If you feel a need to bash on others choices, it might be worth reflecting why you think this course of action actually adds any light to a discussion. From what I've seen, it only adds heat.
Some tools are appropriate for particular situations. Most are better off being entirely replaced. There are thousands of programming languages out there, while the ideal toolbox would contain dozens at most; our industry badly needs some pruning. We need to have these conversations, and they're not going to be easy precisely because we're emotionally attached to our tools, but frankly if you're really so detached as you claim you shouldn't have a problem with people attacking Perl. These discussions are not as evidence-based as we'd like because the evidence simply isn't there, on either side; anecdotes are not the ideal way to learn, but they're a lot better than nothing.
> The data used as evidence are StackOverflow analyses, or Tiobe scores, or, insert additional popular, and often self-selected, data sets. You have to make specific assumptions about some of the data presented to be able to accept it, such that each community has about the same rate of people searching for answers on SO, or other places. Or that the searches will have relevant terms in the in each case.
> This is a stretch to put it mildly. If I google for DBIx::Simple, and this search is caught by one of these filters, will it show up in Perl or not? I can't actually answer this. I have to refer to what the collectors of the data say on their own methodology [1][2]. I am not saying that there are not secular changes throughout the industry, or that various observed gross trends are "wrong". What I am saying is be careful reading into these analyses too strongly, as they may not be measuring what you think they are measuring.
No measure is perfect, but we're seeing similar trends from multiple sources and they align with my own experience as well. I don't see any value in throwing shade on the measures we have. If you have specific criticisms or reasons they might systematically favour one language or another then by all means post them; otherwise this reads like rearguard sowing doubt because you don't like the results.
> In many cases, over the last 20 years or so, I've seen folks pushing Python happily talking up why they left or abhor Perl, usually saying/quoting things they've heard. From my own experience, Perl 4 and onward, much of what they complain about was Perl 4 or before. Likely before many of them started programming. That is speculation on my part, but it does appear to fit what I've observed.
Now you're the one bashing for self gratification. Is it so hard to believe that people might genuinely have bad experiences with your preferred language?
> I am comfortable and competent in 5-6 at any one time, and can easily work in Python, C, Julia, Node, etc. w/o major issue (though with google nearby for things I don't have on the tip of my memory).
Those are pretty similar languages, or at least admit a similar style of programming; if you want a good toolbox you'd do better to learn a smaller number of more radically different languages. 5-6 languages is far too many to know particularly within a narrow range like this; I'd bet that you're not writing idiomatic code in many of them. I used to pride myself on knowing a large number of languages; now I've realised being able to do more in one language is much more useful.
The same holds for every better dynamic language with compile-time evaluation.
E.g. LISP with its reader macros. Even if LISP is trivially parsable, it still provides parse-time hooks which can lead to undecidability.
Parsing POSIX shell is not undecideable, but bash adds a construct that relies on dynamic parsing, much like Perl.
(I cite this Perl article and the C++ one in this thread. And there is another one about parsing GNU Make.)
FWIW, Larry Wall has mentioned many times that Perl 6 fixes this problem. So he very much views it as a language design flaw. I don't think you can argue that it's not.
I watched 3 or more videos on Perl 6 and he's mentioned it at least twice.
It's almost 2 years since Perl 6 was released and it's still dog slow at what Perl 5 was famous for - string parsing with regular expressions. A 19Mb Apache log file on my 2010 quad core Mac takes Perl 6 21 secs. to search for lines containing 15-character words compared with Ruby: 4secs, Perl 5: 2.4 secs. and PHP7: 0.8 secs. We keeping hearing how the optimisations are coming but I haven't seen any significant improvements in string parsing since Perl 6 was released in December 2015. How can you market the advantages of a new version of a language when it can't even match its predecessor?
Because its faster at OO than Perl 5 and has a tonne of other builtins that make it easier to write algorithmically performant code. Not to mention its trivial to write parallel code. I dont think there have been any optimisations in the regex engine in the time you're discussing. The raw IO however has seen huge improvement, especially if you state you arent using unicode and don't want grapheme normalisation. In 2011 just my tests took 35s to execute. Now that's 1s and startup time is 2/3 of that. Something like CSV parsing or even log parsing where you split instead of regex is competitive. Last I checked faster than Ruby but slower than C. But yeah you do still have to work around the slow bits, or be explicit with what you want like ascii IO.
Faster OO but dog slow regexes? This is Perl, right? The Practical Extraction and Reporting Language where extraction is largely the work of regular expressions and, now, grammars. OO languages are a dime a dozen so how can OO be Perl 6's main priority?
To be fair Perl 6 returns structured data from regexes, whereas Perl 5 returns flat data. That has huge implications on how different the regex sub-languages gets parsed. It also has a significantly different syntax, and integrates more into the rest of the language. Basically it had to be created from scratch, so that would mean that it couldn't benefit from the already existing optimizations of the Perl 5 regex engine.
Perl 6 is also a mostly unpaid volunteer effort. So everybody gets to choose what they work on, and very few people are brave enough to work on that aspect of the compiler.
Also I would say that the main priority of Perl 6 is to integrate many ideas from many languages and bring them together in such a way that it seems as if all of these ideas always belonged together.
The reason why the object system sees more optimizations is because everything is, or can be seen as, an object. A big improvement there, can for example make regexes faster.
So? It's not that uncommon for highly dynamic languages to do this. Lisp macros for example depend on being able to run arbitrary code at compile-time.
Is it? (I honestly have no idea about Lisp.) It isn't just about being able to do stuff at compile time: In Perl's case, as I understand it, you can't determine if a string of text is a valid (in the sense of generating an AST!) Perl program without executing it. This precludes things like reliable syntax highlighting.
Languages can include meta-programming/macro facilities without effecting whether or not the parser can do its job; I am fairly certain that Rust's macros are an example of this. Python, as a more dynamic language, also includes metaprogramming facilities (metaclasses, decorators) but IIRC, can still be parsed without needing to simulate a Turing machine.
In Lisp you can modify the read table at run time, so you can do whatever you want. The functions the reader calls when it comes across '(', ')', ' ', and every other character are all completely customisable.
Well, for one thing, it really shortens the discussion if you take advantage of it. For all languages that require arbitrary code execution in that language at compile time in order to be parsed, parsing therefore is Turing complete and therefore has all properties of Turing completeness, including undecidability. QED.
You know there was that recent Stackoverflow analysis that concluded that Perl was the most disliked programming language?
It got me to thinking about how Perl managed to become quite so profoundly disliked, and I remembered these papers and thought that maybe things like this are the reason.
Perl is designed to make life easier for the guy who writes the code, not the one who reads it.
The motto "there is more than one way to do it" is telling. It allows beginners to write code the way they are most familiar with and give experts a large toolbox to be most efficient in many situations. The trouble is that while the writer only needs to know a subset of the language, the reader has to know everything in order to read other people code.
This philosophy make it very suitable for quick hacks, and that's its primary use. The problem is that quick hacks have a tendency to stay, and some poor guy need to maintain that mess. And when your experience with the language is to maintain the unmaintainable, hate is totally justified.
Note that is is possible to write clean Perl, but it requires effort, and unless you are writing Perl modules, there are probably better languages for that.
Compiler undecidablity is not a problem. Sure, it is not intellectually satisfying, and it may be troublesome for some application where formal proofs are required, but for a language like Perl that is all about practicality, no one really care.
People don't really care about how hard it is to parse a language, and complex grammers might actually be due to making it easier for humans. One of the bigger differences is IDE support, but more regular languages that compete with Perl had about the same issue here...
Perl derives its dislike from about the same source as BASIC (and arguably PHP): Early errors/preconceptions and plenty of non-programmers writing code (home computer users, sysadmins). Perl4 was used for some pretty hacky jobs, replacing sed/awk/shell combinations (which were horribly fragmented across the unices of that time). Modular Perl5 code had little to do with that, but by then the damage was done. Early CGI scripts didn't exactly help, either.
Modern Perl is a step further than that, but when Moose and the like became popular, people already moved away to PHP or Ruby, both being part of the same family.
Perl has a lot of crappy language design decisions (which make it "fun" and a tire fire waiting to happen in any large-ish codebase):
- interpretation of a variable (is it a list, a number, a string, a hash?) depends on the context in which it's used, and the context depends on, um, its context;
- pervasive global state (`$_` and friends);
- you can mess with compile-time operations, patch the language on the fly, e.g. during module imports;
- autovivification: a single read by key from a hash is enough to actually create this key; variables are a number and a string at once, but the number will not be computed until you need this variable in number context. Reading a non-existing key in a hash as a hash actually creates a new subhash.
- ties: you can override access to any variable by your methods;
- the built-in data structures are special, there is no sane way to emulate and extend them (but, as usual, for sure there are insane ways);
- the built-in `sort` takes a code block (not a closure with parameters), that has magic variables `$a` and `$b` appearing out of thin air. It looks like a closure, but it's not.
- features are often added in a convoluted way. E.g. there was a (now deprecated) feature that allowed `push` and `shift` to take a reference to a hash instead of a hash directly. How was it implemented internally? Basically by backpatching the error condition when the existing `push`/`shift` choked on a reference.
- the language design principle is "Do What I Mean" (where the "I" part varies). It's ironic that a language built "for human communication" by a linguist (what could possibly go wrong?) is harder to read and to reason about that programming languages built around logic.
On the other hand, if your business brings enough income to pay good developers with strong discipline, you can still have a big codebase in Perl and sustain it for years: it's better to have a terrible language and good engineers than bad engineers and a good language.
$ perl -E '$_ = "A"; say; say for ("B", "C"); say;'
A
B
C
A
For me, dynamic scoping (and, relatedly, RAII) is sorely missed in languages that don't have it. (Although I do agree about $a/$b in sort -- that's a language wart, but not too bad in practice)
> - autovivification: a single read by key from a hash is enough to actually create this key;
Autovivification is another feature that I miss in languages that lack it.
Your points about the perl5 implementation are definitely accurate, although I suspect a lot of language implementations have their own dirty laundry as well. :)
>It's ironic that a language built "for human communication" by a linguist (what could possibly go wrong?) is harder to read and to reason about that programming languages built around logic.
It's not like having a fascination with weird language quirks makes you have good taste in languages. Especially because weird quirks are the end of usability.
Perl is essentially a pigdin or creole language composed of C, shell, awk, sed and POSIX concepts with bits of Lisp thrown in.
If you know Unix, you will already know about 80% of perl. If you know Perl well, you already know a lot of Unix concepts.
Perl is a pain to learn if you don't have a solid Unix background. However, IME, if you acknowledge the sources Perl draws from, look at how they're integrated, and spend some time learning the underlying technical culture, it actually simplifies the learning process.
Interestingly enough, it's also easier to learn a natural language if you spend some time learning the underlying culture.
>Perl is essentially a pigdin or creole language composed of C, shell, awk, sed and POSIX concepts with bits of Lisp thrown in.
That mixing and matching seems exactly like the quirks a linguist would pick up that lower usability (at least for the general user, Unix users are kind of used to being thrown in the deep end of the usability pool).
Perl is disliked because it has a very shallow learning curve to do badly, and a high learning curve to do well. Therefore, lots of people see a lot of bad code, but also people don’t understand a lot of good code.
Its the main reason any language is hated. JavaScript now is less hated because the tooling got there and people were educated at university to program in it well. PHP and Ruby are on the list of disliked on the SO analysis. Which is basically nonsense for modern versions of both languages. I really wish these stats would state "Perl 5" too, as Perl 6 is really modern in semantics and syntax and is nice to code in.
I agree that Perl 6 is the first readable version of Perl. It might actually be considered a nice language. Yet all the tools that are newly rewritten by our Perl guys are in Perl 5 because that's what they know.
Well not just what they know, but what all their existing stuff is written in. Makes sense too. The two Perls aren't really that compatible, far worse than migrating Python 2 to 3 and companies struggled with that manoeuvre. You can run and call each language from the other, with some in memory wrangling between https://github.com/niner/Inline-Perl5 But the same is true for Python and Java objects.
Perl being a dead and disliked language has become a meme. But the community is still very much alive and a lot of cool stuff is being built with Modern Perl. http://mojolicious.org
Perl used to have fans with meetups and so on. I've not heard of these for a long time.
IMO three things killed Perl, leaving it as an unpopular legacy husk:
- loss of ecosystem. The high points for Perl were CGI.pm and its use as a "super awk" by sysadmins. The first was obliterated by other ecosystems, better and worse: PHP, Rails, Node, Go, and so on. The second was obliterated by "servers are cattle not pets": people have moved from meticulous hand-administration to the use of containers, Ansible, etc - or away from systems administration altogether to AWS or "serverless".
- Perl 6 transition. Second-system effect at its highest. The long wait for this to be completed absolutely destroyed incremental improvement because everyone was waiting for a big bang that came very late. Python managed to avoid this level of community damage but has still split into two languages, Python 2 and Python 3.
- the "two Perls" of style; one was the Wall-influenced style that looked a bit like English. The other was sigil-heavy and incomprehensible. Eventually people decided that it was easier to put up with syntactic whitespace than remember all the $? and $| and so on, so a lot of the Perl audience moved to Python.
> IMO three things killed Perl, leaving it as an unpopular legacy husk [...]
I don't really think it was any of these. There's much simpler mechanics at
play here: Perl's competition (Python and Ruby) has about the same
expressiveness, but is much easier to learn, so for a long time very few
people have chosen Perl to learn. There was simply not enough young blood to
replace old timers that were retiring, dying, or migrating to other languages.
I find that interesting, since of those three, Perl was the first language that really "clicked" for me (Ruby was almost that language, but it didn't start clicking until after I had learned Perl; Python still ain't really clicking, though it's gotten a bit better lately).
Perl5 is the second system. That's why it seems so bloated. The releases of Perl5 since Perl6 work started actually became larger and more frequent. There's lots of work between, say, 5.8.8 and 5.28.8 including making lots things to do with regexes iterative that used to be recursive. Old features now finally have explicit deprecation schedules. Lots of features in the core and popular libraries are back-ported from Perl6.
It's definitely a new start, but both Perl 5 and Perl 6 each have various modules bridging the gap between the two. Yeah, they're definitely separate languages, but (at least in theory) they're very much interoperable.
I don't know much about the Python ecosystem, but my impression is that besides the 2to3 program there wasn't really much of an effort to make them work together.
A big contributor to the demise of Perl, IMHO, was the failure of Catalyst and mod_perl to compete with PHP and Rails. mod_perl security was too risky for most ISPs and Catalyst, with it's clunky subroutine attributes style of routing and hefty CPAN dependencies, was a pain to get up and running. Mojolicious was a big improvement but too late to stop the PHP and Rails defections.
It's more caused by the toxic climate amongst it's maintainers, paired with technical and management incompetence.
When Larry Wall was still the lead a lot of progress was made, but then it reversed course in the last 20 years. Every single competent developer left or was booted, and not a single of the many designed features for Perl6 were properly implemented in perl5. Perl5 is now purely a religion, with the heresy to express of loss of faith in the supreme leaders gets you booted, whilst uncivil name-calling and technical destruction by wannabe middle-managers took over.
The undecidedability problem is caused by the dynamic lexer. It's actually a feature to drive the static parsing rules dynamically.
Perl is a very practical language. But this practicality has been achieved by building features on top of bad design. The result is a big, complex and quirky language. To make this worse, the community decided to "fix" this re designing the whole language from scratch. They created Perl 6 which has a much better design, but it's incompatible. The community now it's broken in two and the future doesn't look that good.
I think the word "big" above is often overlooked when discussing Perl (5). For a scripting language, there are an incredibly huge number of core language features. Even compared to something like Ruby or a lisp-like language with a true templating/macro system. It's easily up there with c++ in terms of "number of (sometimes crazy) things you can do with the core language/distribution out of the box".
And that's not even a statement about how many ways there are to the same/similar things things; these features all are intended to facilitate different stuff. I think it is the biggest language I've ever programmed in, fighting for top spot with C++.
I think core-language-feature counts are something it's better to have in moderation. JavaScript of ~2010 was far too small a language, so it had crazy library/cargo-cult utility bloat. Lisp is somewhat similar: it's elegance in its small size and simplicity, but that results in a lot of beginners (re)writing a lot of unnecessary code. Perl and C++ have too many core-language features; everything else is somewhere in the middle.
...and all that is without even getting into some of the insane language extensions you can find in third-party libraries. There's an on-after-module-load hook someone wrote that's implemented in terms of a syntax extension to the language, that isn't quite an operator or a statement. There's a coroutine library which is written mostly inside to the fatal-killsignal core dump handler I think (or something similar). And the list goes on.
> I think core-language-feature counts are something it's better to have in moderation.
If an app needs something, it will either get it from there, or failing that, from add-on packages.
That only matters for fitting into a small embedded system where you can perhaps get a smaller image if you just bundle the exact set of packages that are required.
Due to inter-package dependencies, that plan can easily be foiled.
In the end, it's better to have a big, "batteries included" language. For one thing, it is all released at once. No separate versioning for one hundred different packages.
The regression test suite for the language can cover that functionality which would otherwise be in packages. No nonsense of releasing a new version of the language and then relying on field reports about broken packages.
I agree about batteries-included languages, but that applies more to library-type tools, IMO, than language features. A library-type tool is something like "I need to get an md5 hash; I hope a function to do that is included with the language distribution so I don't need to go find a library!". A language feature is something in response to questions like "How do I express that I'm calling a method on an object? Or that I want to read a key out of a dictionary object? Or automatically generate code for a method when I call something that doesn't exist?". Those are sometimes implemented in terms of libraries, but are instead often implemented in the syntax and behavior of the language/runtime itself. For example, Java has a specific syntax for "call a method on an object instance or class", and that's "thing.methodname()". Sure, it could be implemented in the library style ("call_method(thing, 'methodname', args[])"), but that's typically not what people want. Perl tends to have, in my experience, an outlier surplus of language features and libraries.
I'm only arguing for moderation in the syntactic/language-feature department; I agree with you that a good, curated set of wide-ranging libraries is something that every language should have--ideally as part of the core distribution.
> but that applies more to library-type tools, IMO, than language features.
I'm a Lisp person of many years, so my perception of this distinction has gradually atrophied, dried and fallen off.
But even in this context, I would still rather have a larger language (more stuff which is Just There), even though more kinds of things can be add-on modules in Lisp than in something like Perl.
It's actually quite interesting, from what I've understood it's one of few well adopted programming languages that's designed by a linguist and made primarily to be easily understood and written by humans.
At the time of inception and around the peak of popularity I do believe it was a quite innovative language. But by now we have a much larger set of languages aimed for the same target group, many of which have gained larger adoption among developers of this time.
In a way I can almost see Node as "the new Perl" in the sense that it's a widely used language across platforms praised for it's large set of available libraries and ease of creating "quick n' dirty"-hacks.
>how Perl managed to become quite so profoundly disliked
I'm guessing the reasons are actually more conspicuous than computer science concepts of "undecidability" since most working programmers don't read academic papers to judge whether they like/disklike a programming language.
The conspicuous reasons seem to be a combination of:
1) PERL's usage of sigils.[1] One the one hand, it makes code compact and terse. On the other hand, many perceive the source code as "line noise" or "sigil hell". This is the opposite problem of other disliked languages like Objective-C where people complain it's too verbose.
2) PERL not having a constantly updated ecosystem that keeps up with new trends in computing. PERL was great for text munging (alternative to sed & awk). However, PERL wasn't extended as the driving language for dynamic web pages (Brendan Eich created Javascript instead of embedding Perl interpreter in Netscape browser), or GUI data entry forms programming (Java and C# gained popularity), or machine learning (Google developers designed Python to be 1st class in Tensorflow), etc.
tldr: PERL is perceived as "legacy" with ugly syntax
Point 2 is kind of nonsense. The ecosystem is incredibly big and keeps up with most things. Name something then search here https://metacpan.org/ The main missing stuff is anyone marketing heavily their libraries and there being communities around them etc. Like probably no one knows what PDL is, even though it was around long before numpy+scipy etc. Before data science trended in the mind of hipster VCs and coders. The naming was to try and win over people from the IDL language, used mostly in image analysis in physics/geography. A niche crowd to be sure. Perl sort of never caught on to the modern style of advertising what its got. In the same way no one really advertises grep, awk or sed but lots of people still learn and use them.
The size of the CPAN is certainly impressive. However, past a certain point, a big, multipurpose, monolithic Perl codebase being worked on by a ton of different developers is going to have significant problems caused specifically by the use of different CPAN libraries: many, many quite common libs do not "play well" with each other in quite simple cases. And I'm not talking about "I'm trying to glue together two third-party tools that weren't written with each other in mind", I'm talking "I have a request handler that once, an hour ago had to load and call a function in a given module, and is now issuing cryptic errors on all requests of a certain type because they happen to call a function in a different, totally unrelated module that worked before".
This is largely because of the sheer volume of weird global state inspections/mutations you can do in Perl--or I guess it's more accurate to say that Perl has a conveition of it being "OK" to heavily and frequently inspect and mutate global state. You can monkey patch in many languages, and sometimes it's even encouraged (Ruby), but only in Perl is it not uncommon to see monkeypatch removal or seriously altering replacement of core functionality. I've had modules hackily unload other already modules because the loaded modules' names matched a buggy load-time regex. I've had packages clobber text handling or encoding routines in other packages at compile time, or only after calling a certain function a certain way. I've had modules change the behavior of the core signal handling APIs so that any code that talked to them . . . didn't actually handle signals. And those are just the pithy examples that fit in a single sentence.
Now granted, this isn't a criticism of Perl-the-language but more of (depending on how you choose to interpret it) library authors who don't prioritize or even consider interoperability with other tools, or of Perl-the-community's conventions regarding when it's OK to go mess around in globally-stateful guts of code you don't control. You could also just as easily say that it's a symptom of the big, multipurpose monolith I had to maintain--which is valid, but other not-designed-for-huge-projects languages don't, in my experience, have problems quite this bad when they're forced to scale.
My goal isn't to cast blame, but to point out that CPAN is incredibly bloody far from a high-quality, stable, or usable code repository for certain very common use cases.
I read your post carefully, and I even agree with parts of it. There are major modules/module families that don't work together.
However, that's light-years from the claim that I quoted.
There are a lot of different ways of doing the same things in Perl the language and in the CPAN ecosystem. That's a strength and weakness. But in my experience, the authors of most of the modules care very deeply about doing things in a sustainable way.
I agree there is a lot of dross on CPAN. I've also lived the frustration of seeing two kinds of exception handler TryCatch vs Try::Tiny in the same subdir of a codebase. The issue is really that a lot of basic modern functionality requires CPAN, and the core of Perl 5 is small and mostly not super helpful. Something akin to Moose in core as the new standard way to do OO would have been a good plan 10 years ago.
I wasn't talking about the size of cpan because it's not relevant to my point. I was talking about Perl not being at the forefront of everyone's minds and being used as a 1st-class environment as computing entered new domains. E.g. instead of Sun or Microsoft taking an existing language like Perl and giving it a canonical IDE to let programmers write data entry GUI applications, they create Java & C# instead. When Google/Android decided on a development language for their smartphone SDK, they chose Java instead of Perl. It doesn't matter if cpan has mobile phone libraries now.
You seem to be taking my observations about Perl as some sort of veiled attack. I'm just reporting why and how Perl got to the state of being "disliked" today in programmer surveys. It's not about the "undecidability".
Ok then your definition is corporate ecosystem then? Perl in general is hardly the stuff of scaled soft eng. in a mega corp. It wasn't designed for that, but to empower an individual to be highly productive quickly. With that in mind the ecosystem is super healthy, even by your definition. I'm more shocked Python has managed to bridge that gap, but so did Pascal at one point so I guess designed to be a teaching language wins out!
>I'm more shocked Python has managed to bridge that gap,
That's more to my point. Old languages like C++ and Python keep getting rejuvenated as 1st class drivers of innovation but Perl (the language -- not the cpan) keep getting ignored.
I was surprised when Google chose Python as one of the 1st class languages for its new Tensorflow instead of a new language like Julia. I do understand why they chose Python but nevertheless was surprised.
Same for C++. It gets rejuvenated in things like graphics programming (NVIDIA's CUDA SDK is C++ not Perl). And when Bitcoin showed up in 2009, it's canonical client was C++ not Perl. Also, updates to C++ via C++14 and C++17 were discussions that turned into reality whereas Perl 6's long development became a running joke about vaporware.
Perl5 and Perl6 don't really have any new stories like that where it gets rejuvenated. Therefore, it keeps dropping off everyone's radar as "legacy".
Whether Perl programmers are highly productive with Perl isn't really the issue.
> Same for C++. It gets rejuvenated in things like graphics programming (NVIDIA's CUDA SDK is C++ not Perl). And when Bitcoin showed up in 2009, it's canonical client was C++ not Perl.
Perl is not competing with C++; they're entirely different languages with entirely different usecases. Comparing it to Python is reasonable; comparing it to C++ is silly.
> Also, updates to C++ via C++14 and C++17 were discussions that turned into reality whereas Perl 6's long development became a running joke about vaporware.
Newer C++ versions are more akin to newer Perl 5 versions like 5.26 (May 2017), 5.24 (May 2016) etc. Perl 6 is a new language using some of the same ideas; comparing Perl 5 and Perl 6 is like comparing C++ and C#, not C++ and C++17.
>Perl is not competing with C++; they're entirely different languages with entirely different usecases.
Yes, I understand that C++ does not compete with Perl. My point is the rejuvenation stories, not the runtime or use case differences.
I use a utility every day called ExifTool[1] that's 100% Perl source code or very close to it. However, ExifTool does not keep Perl at the top of mind the way Tensorflow brings Python relevancy to a new generation of programmers.
> Yes, I understand that C++ does not compete with Perl. My point is the rejuvenation stories
Well, the way C++ had new versions released in 2017 and 2014, Perl 5 had new versions released in 2017 and 2016; what stagnation are you demonstrating? You said "updates to C++ via C++14 and C++17 were discussions that turned into reality"; and the same thing happened with updates to Perl 5 (which is the language "Perl" is usually shorthand for). Perl 6 is an entirely different language, it, along with languages like Ruby, compares to Perl 5 the same way C# and Rust compare to C++.
My point was that the fact that C++ (like Perl) has had multiple updates in the past few years, and that Nvidia chose C++ instead of Perl as the primary language for an API are not evidence of Perl's decline. Perl 5 receives more frequent updates than C++, and C++ is being used where it makes sense and where Perl wouldn't have been used even when it was the new hotness. How is that evidence that Perl has fallen off?
I'm not saying that Perl's popularity hasn't greatly declined, I'm just saying that the evidence you're offering for it isn't evidence.
But it's not just quantity of updates. It's perception of the updates and what new things they bring to the table. Surely you're aware that many Perl programmers abandoned the language in between Perl 5 and Perl 6 because they felt it was getting neglected. (There's also a long post from a ~20 year Perl veteran (forgot his name) of one of the famous libraries on HN explaining his reasons for leaving Perl before Perl 6 but I can't find it at the moment.) How do we reconcile why they thought Perl was stagnating even though it was getting frequent updates?
This was the opposite perception of C++11, C++14, C++17 where many programmers were complaining that it was getting too many features and getting too complicated.
>Perl wouldn't have been used even when it was the new hotness.[...], I'm just saying that the evidence you're offering for it isn't evidence.
Ok, I shouldn't have derailed the discussion by giving the impression that NVIDIA SDK could have been Perl. The main idea is that old languages other than Perl are getting in the news for new domains.
Let me be more generic: There is no new rejuvenation stories where <any_domain_where_Perl's_runtime_model_and_scripting_semantics_is_appropriate> was chosen by a new computing domain help keep it relevant and keep it from being "disliked" by programmers. Is that wording more acceptable and suitable evidence of Perl's decline?
I'd also still like to get your opinion of why Perl has declined in mindshare and is one of the most disliked languages in programmer's survey.
> 1) PERL's usage of sigils.[1] One the one hand, it makes code compact and terse
Sigils have nothing to do with Perl's terseness; actually, they make code very slightly (one character per variable) more verbose. In Perl 5, $foo is a scalar, @foo is a list, %foo is a hash, etc. $foo[0] is the first element of the list @foo; it gets a $ because the element being accessed is a scalar. This is in contrast to most languages where variables are referred to like 'foo' and that's that.
But when you talk about Perl stagnating and losing out to other languages, the languages it lost out to were Python and Ruby, which don't require any type notation. It also lost out to PHP, which has sigils, but they don't carry as much information: $foo just means foo is a variable. Perl didn't lose out to C++ and C#; they were never really competing in the same domain.
In Perl, you write:
my @list = (1, 2, 3);
Whereas in Perl's popular successors, Python and Ruby, you write:
list = [1, 2, 3]
Saying the former lost out because the @ makes it unreadably terse is nonsense.
>Saying the former lost out because the @ makes it unreadably terse is nonsense.
Well, that's not what I claimed. I also wasn't really focused on "@%$" specifically but you had brought it up so went with it. (I get this weird feeling that I'm discussing with someone who's emotionally invested in Perl and he feels like I'm bashing Perl. Please let's us both stop this and make sure we're talking about Perl in a detached manner.)
Yes, strlen("my @list = (1, 2, 3)") is greater than strlen("list = [1, 2, 3]"). I wasn't talking about that. I was talking about things like strlen("@") < strlen("arraylist"). But... "C# doesn't compete with Perl!". Yes, that's true.
A realistic scenario where perceptions of "@" and "Arraylist" is compared would be a C# programmer working on an ASP.NET website or Javascript programmer working on Nodejs and then the company needs him to go fix an old website that was written in Perl ~15 years ago. The old Perl programmer left and C# programmer is stuck looking at Perl's "line noise". That irritated C# programmer then fills the Stackoverflow survey expressing his "dislike" of Perl. The C# and Javascript looked "readable" but Perl syntax such as "<>" looked like gibberish.
> I also wasn't really focused on "@%$" specifically but you had brought it up
My involvement in this conversation started with quoting you saying that one of the major reasons for Perl becoming disliked was "PERL's usage of sigils.[1] One the one hand, it makes code compact and terse". Perl's use of sigils has nothing to do with terseness, and since Perl lost its mindshare to Ruby and Python which to the tiny extent that sigils contribute to terseness/verbosity are more terse, I don't think that's a valid point about Perl's trajectory.
> I get this weird feeling that I'm discussing with someone who's emotionally invested in Perl and he feels like I'm bashing Perl.
I don't even know Perl, I'm just critiquing your logic.
>, I don't think that's a valid point about Perl's trajectory.
Again, the "Perl lost to Python/Ruby ... terseness" connection is your narrative, not mine. I feel you have my comments mixed up with someone else.
>'<' and '>' are not used as sigils in Perl.
I agree and I didn't say they were.
That's 3 cases of nitpicking something I actually didn't claim. I can only assume this over-interpretation of things I didn't write is a result of some underlying irritation that I caused. Let's just stop. Peace.
> Again, the "Perl lost to Python/Ruby ... terseness" connection is your narrative, not mine.
Well, if you just weren't considering Python and Ruby, then aren't they counter-examples to your point? They're terser than Perl in that regard; if that's a major reason people moved away from Perl, then why did so many of them move to those languages?
> I agree and I didn't say they were.
Then why did you bring them up in a discussion about sigils?
Again, that wasn't the "regard" I was focused on. It wasn't strlen(Perl_syntax) to strlen(Python_syntax). It's not about counting characters. It was terseness of non-obvious meanings for symbols which reduced readability for many. Yes, "$foo=7" is literally 1 character longer than "foo=7" which seems to violate terseness. (This is the example you seem to always gravitate back to.) For the 2nd time, I'm stressing that I already agree with that definition. However, that wasn't what I was talking about. People unfamiliar with a language that happens to have "ArrayList" spelled out will see as not being as terse as "@". It's a different axis of terseness. This cognitive readability is orthogonal to whether people migrate to Python because it's 1 less character type in front of a variable name.
>Then why did you bring them up in a discussion about sigils?
I wasn't talking about sigils exclusively by that point.
I was talking about overall readability and "line noise" to fill out the C# story.
> Yes, "$foo=7" is literally 1 character longer than "foo=7" which seems to violate terseness. (This is the example you seem to always gravitate back to.) For the 2nd time, I'm stressing that I already agree with that definition. However, that wasn't what I was talking about. People unfamiliar with a language that happens to have "ArrayList" spelled out is not as terse as "@".
I gravitate back to sigils because your point, that sigils' terseness contributed majorly to Perl's decline, was all I was objecting to. Python, Ruby, and Javascript don't spell out ArrayList either, yet those languages are now being used in most of the places where Perl used to be used. I ask again, if that was a major reason people left Perl, then why did the people who had that problem move to other languages that are even terser (ie, they don't spell out ArrayList and they don't even use sigils)?
>I gravitate back to sigils because your point, that sigils' terseness contributed majorly to Perl's decline,
I didn't tie sigils to the "decline" -- I tied it to the survey's "dislike". I also didn't claim Perl sigils is what drove Python/Ruby adoption. I never claimed a logical cause and effect between sigils and Perl's decline.
Indeed, the Rust language adds a whole new taxonomy of sigils[1] and it's on the upswing in popularity. (Of course, someone will probably come along and think I claimed that "adding sigils to Rust contributed to its growing popularity".)
The decline of Perl's mindshare for new domains was totally separate from "sigils". The usage decline was a 2nd observation of why Perl topped the charts of "most disliked" languages.
>then why did the people who had that problem move to other languages that are even terser
You're asking that question because you're still focused on only one string length definition of "terse".
Let me try another way:
strlen(Rust_code) > strlen(Python_code)
... and yet... Rust can still be perceived as more terse than Python. Why? Because special non-obvious symbols that "don't explain themselves" are perceived as terse. This leads to the paradox that adding to the text length makes it more terse. Lastly, not all opinions about Perl's reputation for terseness comes from Python/Ruby programmers.
> The decline of Perl's mindshare for new domains was totally separate from "sigils".
When you quoted someone saying "how Perl managed to become quite so profoundly disliked" and said "the conspicuous reasons seem to be a combination of: 1) PERL's usage of sigils," I took that to mean you were saying that sigils were a major reason that Perl isn't well-liked by as many people anymore. I'm sorry if that was a misunderstanding.
> Because special non-obvious symbols that "don't explain themselves" are perceived as terse.
The Merriam-Webster definition of 'terse' is 'using few words: devoid of superfluity.' It is not a synonym for noisy. 'my @list' is terser than 'List<T> list,' but both are wordier than better-liked-than-Perl languages like Python, Ruby, and Javascript, which is where Perl's mindshare went (I've been taking that last part as a given). I'm not claiming Perl isn't terse, I'm just saying that it was nonsensical to say that 'PERL's usage of sigils [...] makes code compact and terse.' Compared to C#, sure, but Perl was never competing with C#, and most of the mindshare it used to have didn't go to C#, so it's not really relevant. If the extra terseness (not noisiness) afforded by using sigils was a major reason for Perl's unpopularity, then Python, Ruby, and Javascript's popularity is very strange.
print while (<>);
Is definitely terser than
for line in fileinput.input():
print(line)
But you'll notice there aren't even any sigils in the Perl version.
Sigils being ugly and Perl being too terse might both be problems it has, but they're different issues.
You may have made a mistake linking to this page for Rust; as the URL says, it's a backup: the only ones that exist today are *, &, and ', and the former work the same way they do in other systems languages. (With the exception that & is borrow checked but like, it's a pointer inside, same exact deal.)
We in fact removed these sigils from Rust because user feedback was extremely negative about them, and ' still gets a lot of complaints. Nobody has come up with something better though.
No good reason. Purely muscle memory that I picked up decades ago. Maybe I saw someone else do it[1] and just picked up a bad habit. I'll stop the all caps and write Perl from now on.
Because they don't know much about contemporary Perl. It's actually a really good indicator of if someone actually knows anything about the language post the 90s. I used it as a soft hiring filter on CVs. You knew almost as matter of fact any dev putting that on their CV was self taught from monster nests of legacy.
Perl was a great language design lab experiment. They gave people 20 ways to do any simple thing, and then Matz and Guido looked to see which ways became popular and designed great languages that allow only those ways and maybe 1-2 more that are highly frowned upon. I'm almost as glad Perl exists as I am that I never needed to learn it.