by tormeh · 12y ago · 0 comments
The downside of the emphasis on practicality was that the language always suffered from incoherence; with no principled foundation it's been slow to adapt as the practical things users want to do change (e.g. I'd argue string manipulation is a lot less important than it used to be - if you were writing perl today, you might give json manipulation the same prominence as regexes). Perl 6 may have been an effort to fix this, but went too far in the opposite direction; overly formalized, with a premature separation between VM and language that massively slowed development.
There's a lot of good stuff about modern perl - Moose and the like - but IMO it's too little, too late; other languages have been able to improve their infrastructure to (mostly) match perl for easy things. Meanwhile perl's incoherence makes it very hard to write large programs and solve hard problems, where languages with a firmer theoretical foundation and stronger stylistic principles have a huge advantage.
> Meanwhile perl's incoherence makes it very hard to write large programs and solve hard problems ...
I've been on teams writing very large systems solving very hard problems in Perl 5 for more than 20 years. I know that some of that stuff that was written in the 90s is still under active development and maintenance today, even though it's several developer generations in the past.
Perl 5 may or may not be 'incoherent'. It is certainly somewhat idiosyncratic. But so is JavaScript, perhaps to a lesser degree.
Perl 5 in the large requires some somewhat different (but not too difficult) disciplines.
But that's not so different than most other languages.
> In many ways I'd say it was the go of its day.
This made me smile! Thank you again.
I think if "it's not a lot worse than Javascript" is the best you can say in its favour...
> Perl 5 in the large requires some somewhat different (but not too difficult) disciplines. But that's not so different than most other languages.
The problem I always saw was that libraries would follow their own styles, so once you had a project that depended closely on several different libraries you'd be forced to cut against the grain of several of them. It's a problem that's lessened in a language with a single standard way of doing OO, a single standard way to do event-driven I/O, or even trivial things like code formatting. Maybe the perl community has found more of a consensus in recent years.
Nowadays I work almost completely in scala, which some people compare to perl, so I'm concerned about not repeating perl's decline in popularity.
The Perl 6 language design directly addresses this problem. The intent is to avoid throwing out the baby (making both timtowtdi and long term language evolution practical) with the bath water (lack of composability of the various ways to do things and of new features that emerge). The Rakudo implementation is most of the way there.
I also think the Parrot VM project added a few years to P6's gestation.
When you say "overly formalized", perhaps you mean the early break out of mailing lists and especially the Parrot project? I don't think "overly formalized" fits the last decade of Perl 6 development -- Pugs (2005 - 2007) was distinctly anarchistic.
IMHO, it was coherent. But the syntax is wierd (may be usage of symbols $%@{}[] ) for people unfamiliar with it.
I haven't done big projects with perl in the last 12 years. But when I need it, it is like riding a bike.
I'm really afraid that Rails is going the same way, that the DRY mantra is going to eventually lead to a Huffman encoding only parseable by Rails experts, and then no one new will want to get on board.
Most of Perl 5's syntax comes from well established (for perhaps a decade) UNIX culture, from shell, awk, sed, and C syntax conventions. Vanishingly little is actually novel to Perl.
Rails, which is obviously not a peer to Perl, but which you bring up as "going the same way," does similarly have a huge emphasis on convention. But most of its conventions are de novo, made up within the Rails/Ruby community.
You can hate Perl (5) all you like; no accounting for taste and all. But if you find parts of it unfamiliar, it's probably because you are ignoring (or ignorant of) where it came from.
Aiui Larry Wall believes it will be significantly easier for Perl 6 to evolve than for Lisp to do so, without falling in to the Lisp Curse trap.
It's almost anti-academic in the approach and more linguistic. It's superficially like any other curly braced language but there was lots of thought put into how statements are constructed and making things easy to humans to write rather than for computers to process. So it features all kinds of implicit actions and context sensitive approaches to the language and how it works. It's also an amalgamation of several preceding tools and ideas, and in that sense is almost an "English" of the programming world.
Perl is almost more of a human language than a programming language, and like any other human language, once you learn it and some dialects it makes all kinds of natural sense. Even if you're away from it for a long time it comes back like a second language does and you're up and running really quick. It feels less like programming and more like you're having a conversation with your computer friend.
Even small things that you get used to in Perl turn into huge pains in other languages, things like having regexes be a literal type (rather than trying to shoehorn the syntax into a string like in almost every other language) makes wanting to use them and using them second nature and really natural. Having a state machine you can type up in a few characters and be a first class citizen of the language is incredibly powerful.
Perl 6 is supposed to take these ideas and expand on them, lots of clever new language constructs and first-class grammars are exciting new promising notions. It'll be like going from the language a child speaks to the language an educated adult uses.
I'm concerned Perl 6 has missed it's window, but there's enough interesting stuff going on in the Perl 5 community and there's some really smart people working on it that I'm hopeful it'll be more than another language curiosity.
> It's almost anti-academic in the approach
I'd say academic approach to programming languages is anti-scientific and therefore anti-academic on itself. They just don't realize it yet. > Perl 6 is supposed to take these ideas and
> expand on them
The problem is we already have lots of features in Perl 5 that nobody really needs, they just complicate things, raise entry cost, split community, make it impossible to address performance and deployment issues. So, approach on expanding feature set is flawed and frankly always was.Instead, Perl 7 maybe should get rid of all the unneeded features, restrict feature set, restrict coding conventions, make it easier for newcomers, make it easier for everyone to understand each other's code, make it faster, easy to compile and deploy without having to install interpreter and so on. These issues are much more important, than language features. And yet no one seems to understand that.
($v1, $v2) =~ /a(b|c)d(e)/;
(regular expressions are state machines) explicit strong typing
proper parameter lists
active metadata on values, variables, subroutines, and types
declarative classes with strong encapsulation
roles
full OO exception handling
support for the concurrent use of multiple versions of a module
extensive introspection facilities (including of POD)
LL and LR grammars (including a built-in grammar for Perl 6 itself)
subroutine overloading
multiple dispatch
named arguments
a built-in switch statement
hierarchical construction and destruction
distributive method dispatch
method delegation
named regexes
overlapping and exhaustive regex matches within a string
named captures
parse-tree pruning
incremental regex matching against input streams
macros (that are implemented in Perl itself)
user-definable operators (from the full Unicode set)
chained comparisons
a universally accessible aliasing mechanism
lexical exporting (via a cleaner, declarative syntax)
multimorphic equality tests
state variables
hypothetical variables
hyperoperators (i.e. vector processing)
function currying
junctions (i.e. superpositional values, subroutines, and types)
coroutines
lazy lists
strong module and language versioning
concurrent object pipes
http://www.perl6.org/archive/faq.htmlRather consult this instead, which is maintained: http://faq.perl6.org/#features
In Python when I have some data and it grows just a bit too irregular for regexes, I have to start manually writing state-machines or add a dependency on a third-party library and spend an afternoon explaining parsing theory to my co-workers.
Even in C you can use something like Ian Piumarta's PEG generator[0] that let's you embed semantic actions written in C. For regular grammars, scanners and lexers you have powerful tools like Ragel[1] (which targets 7 languages)
I'm not a Python person, so if the Python libraries proved inadequate I'd probably resort to these tools and then push out a Python module using Cyphon[2].
Personally I'm not a fan of using semantic actions for AST construction. I generally prefer the 'attribute' approach taken by libraries like Spirit (C++) which make the process feel a lot more like deserialization. SAs are still useful however for rejecting or accepting rules based on complex requirements (like "is this IP address routable"?).
[0] http://piumarta.com/software/peg/ [1] http://www.colm.net/open-source/ragel/ [2] http://cython.org/
A perl6 Grammar is a first-class object.
LPeg is a library, Spirit X3 (for C++, not yet complete) is a library. Both achieve pretty seamless integration with your code. I think in a library is where this stuff should be.
That's because Perl had a lot of "convenient" shorthand and quirks in the language that could be abused, leading to unreadable, "cat-walked-on-keyboard" code. However, that is just a stereotype. One could also force Perl to straighten its posture with a strict pragma, making much of the eccentricity disappear. I have worked on several large Perl 5 codebases that were/are clean and easy to understand and maintain.
Just like real languages have different modes to communicate in, Perl has it's own modes.
I've worked on a couple large-ish Perl codebases too and with some decent code standard found them really easy to work on and extend.
A much bigger relevant change is Perl 6's support for hygienic lexically scoped "slangs". These can be used to relatively cleanly package composable dialects, DSLs, language tweaks etc. Slangs make it practical for a group to establish a default local policy (policies include anything from switching some language tweak on or off to switching to another language entirely) and for an individual programmer to extend or alter that policy in a cooperative manner.
Slangs aren't yet nearly as easy as they supposed to be, but they're getting there. A couple examples are v5 (which switches to another lang entirely) and Tuxic (a tiny idiosyncratic tweak to standard Perl 6):
https://github.com/rakudo-p5/v5/blob/master/README.md
https://github.com/FROGGS/p6-Slang-Tuxic/blob/master/README....
Perl 6 improves upon Perl 5 in countless ways. One of the strongest parts of perl, the regular expressions, have received further improvements. Check out https://en.wikipedia.org/wiki/Perl_6_rules
Finally, if you are familiar with Perl 5, there's special documentation for you at http://perlgeek.de/en/article/5-to-6
... have been copied to Nimrod (now called "Nim") -- even with native C performance and native Perl syntax.
http://nimrod-lang.org/re.html
Perl had its time and lost many of its users (including me) "thanks" to the inacceptable delay. Meanwhile the competitional advantage of Perl 6 is completely gone because many new features have also been implemented in other languages (Rust for instance), even in dinosaurs like Java and C++.
http://en.wikipedia.org/wiki/Perl_Compatible_Regular_Express...
But PCRE is 1990's parsing technology. Who cares if Nim copies parts of P5 regex via PCRE?
The page you linked says "Consider using the pegs module instead.". PEGs, invented in 2004, are more powerful than regex, PCRE ones or otherwise:
http://en.wikipedia.org/wiki/Parsing_expression_grammar
Perl 6 has Perl 6 rules, a unification of PEGs, regex, and lexical closures, built right in to the language. There's nothing like them in Nim, Java, or C++.
Are you sure?
Nim supports direct access to the AST so macros can be used to define new programming constructs like in Lisp.
Also other languages support things like that (as library), Java for instance:
Unfortunately the one thing Ruby didn't steal from Perl was its speed.
Of course, most apps are I/O bound, objects in the heap are larger than they appear, blah blah blah.
*at least for my definition of "good"