4 ms·
There's more than one thing that "killed perl" (I still use it almost every day.) But I think the main thing that made it long term non competitive were a seri
by downsplat 11mo ago
There's more than one thing that "killed perl" (I still use it almost every day.)
But I think the main thing that made it long term non competitive were a series of bad design choices all the way back to perl 4 or even 1.
Namely:
- the need for sigils
- weird sigil rules where the 0 element of @x is $x[0] not @x[0]
- auto flattening, ex. (@a, @b), and hence the need for manual reference management, as in (\@a, [1,2,3])
- lack of a native object system, and widespread repurposing of hashrefs as objects, with awkward field syntax $x->{foo}
- awkward function argument syntax: my ($x, $y) = @_;
These things add up, and both JS and python showed that all those can be done much more smoothly.
Another thing that counted at the time, is that PHP came out with a slightly worse language, but a super beginner-friendly approach to html templating and request lifecycle: you can just mix php and html in the same file, and the entire runtime environment is nuked at each request. The result was that php replaced perl for an entire generation of web devs in the early 2000s.
- kwoff 11mo ago- weird sigil rules where the 0 element of @x is $x[0] not @x[0] '@' and '%' indicate containers, while '$' is a scalar (which containers can contain). So '$x[0]' is referring to a scalar within the '@x' container. If you operate on a container, like 'push @x, 2', it uses the container sigil. I guess "weird" triggered me a bit, heh. I know it's subjective.
- cowboylowrez 11mo agohaha even your explanation looks 'write only'
- lupire 11mo agoSigils are essentially type tags. That's it. Array x === @x Int x[0] === $x[0]
- archi42 11mo agoHm, if I understand this correctly - awkward function argument syntax: my ($x, $y) = @_; then you might be interested to learn about feature 'signatures': use feature 'signatures'; use strict; use warnings; sub foobar ($foo, $bar = undef) { # do something smart } # call it: foobar(1); foobar(1, 2); Not sure when it was added, but when I write the usual glue code, I love to use it these days.