When I started learning perl, more than a decade ago, I loved that there were so many cool syntactic tricks. From what I see reading this article, perl6 brings even more cool syntactic tricks(/features).
But then I discovered the regular beauty of Lisp, and the syntax problem evaporated at once from my mind.
wow. what a mess ... and they're still not done. seriously, mod me down if you will, but someone has to say it. i will carry this cross :P - compare this, with something that would be titled "what you can do with python 3 today", or ruby, clojure, cl-lisp, javascript ... perl was revolutionary and it changed the world. we were using it at a NY financial institution since v4. we loved it. when 5 came out, we went all in. we had configuration files in perl, when every one else was writing parsers, home made databases when people had to buy sybase licences, home made template languages (yes, more than one. it was that easy) when others were struggling with c++ string libraries. and we killed; (lispers had always had these and more benefits) but alas, the world has moved on.
... and we're getting tired. it is much easier to find ruby and python guys, and i always thought ... "python? that's for sissies." until we tried it. and fellow programmers, i still had energy at the end of the day. that was the most striking. perl tires you out. perl culture and community tires you out. what a difference python makes.
initially i missed some things, but you quickly begin to see the light, and in no way will go back.
my theory is that python/js/lisp are simple because the core ideas are few. ie, because the rest of the language is the logical implication of a relatively few simple ideas. lisp is the best at this. the fewer special forms, the fact that you write in the same data structures the compiler sees (less complication) which translates into less to remember. less to keep in mind (quickly, what is the difference between 'use' and 'require' and system("") or system(@) ... bleh) which leads to less energy needs to get your stuff done. on this energy scale, perl rates pretty high. not as high as c++ but high enough that i never want to use it again.
so go ahead reader, mod me down and throw your tantrum, and try python (or ruby, etc ...)
Wait, you're saying Lisp is simpler than Perl and then you use "use" and "require" as examples? How are "use" and "require" different from "(eval-when :compile-toplevel ..." and "(eval-when :load-toplevel ..." and "(eval-when :execute"?
Lisp and Python aren't as simple as you think they are, and Perl isn't as complicated, either.
different keywords passed to a well understood form: "eval-when". what each opt does can be horrendously complicated if you so chose. however i understand the evaluation rules and can just focus on learning what each option does. require on the other hand can take a string, but it
can also take a VERSION expression that will then be compared to
$]. but wait, there's more. it can also be a literal v5.6.1 - that
works too. otherwise it will look for a library. if the expression is
a bare word require will conveniently add the .pm for
you, however notice that $lib = 'somelib' require $lib is not a
bare word therefore you need to add the '.pm' ...
> compare this, with something that would be titled "what you can do with python 3 today", or ruby, clojure, cl-lisp, javascript
This is about syntax. Please do post the equivalent examples in any of those languages. I bet the perl 6 will be a lot shorter, which is the whole point.
My God. Here's their example of the "reduction meta operator".
say [+] 1...5; # sum
say [*] 1...5; # product
say [<] @list; # is @list strictly ordered ascendingly?
What the hell? With [*] they go for a reduction, but with [<] they go for a reduction over a zip of the list with its own tail. The behavior changes completely! How do you predict that? That's simply dumb. Extremely dumb. Things like this don't make the language complicated, they make it risky. It is risky to write Perl 6 programs. And we know programs don't get any thrill out of that.
The syntax seems perfectly reasonable, or even natural, to me. Perhaps you're over-thinking the specifics, or are too used to other functional programming languages where 'reduction' has a slightly different, more specific, meaning (i.e. fold).
Note that this means, unlike the normal reduce, that it follows the operator's default precedence rules, and presumably the less-than operator works similarly to Python's in that it allows comparison chaining (i.e. 1 < 2 < 3 works as you'd expect) to make the result using reduce seem natural.
You predict what a hyperoperator does by knowing what the non-hyper operator does. Your question about predictability reads to me like asking "You can modify verbs with adverbs! How in the world do you know what a verb means?"
It's completely different behavior depending on the type of operator.
Edit: And apparently it even respects the associativity of the operator! There is nothing gained by making the language more complicated just to cut a few characters.
If you use the operator, it's (hopefully) safe to assume you know what it does. Then you should also know what interleaving the operator between the list elements does. Which is exactly what the reduction does. I don't understand your problem with it.
yeah. i don't really get what is being gained. you have to keep some much context in your head in order to write perl - as compared to python ... it's tiring (as i keep saying)
It's all about context. The more of the enclosing context you need to keep in mind to understand a line of code, the more you increase the cognitive load on the programmer.
Whatever this turns into, whenever it's ready, I think Perl 6 needs a re-branding. There's just too much baggage associated with the name after all this development time, I just naturally think "vaporware".
That has nothing to do with the technical merits of the language, but perception is important - especially when you are trying to convince someone to use it for a project. Ruby is positioned as being "new and exciting" and the successor to Perl. If Perl 6 is going to be relevant it needs to get in that spot.
It has taken me years to absorb perl's little idiosyncrasies and I've learned to like it. Then I read perl6 docs and I can no longer defend using perl. For example, here's the perl6 tertiary assignment:
my $foo = $bar < 1 ?? 0 !! 1;
Every other language on the planet including perl uses ?: for the tertiary but perl6 just had to be different for no good reason other than to be different. No. No, No, No thank you. Consistency matters. The most important feature in any programming language is clarity. Producing Pascal's Triangle using less than 5 characters of source code is not something programming language designers should be aspiring to. Python is looking better every day.
Perl 6 changed the syntax of the ternary conditional operator for other reasons: less ambiguity of syntax, for one. (If you're really curious about the reasoning, I believe Apocalypse 3 "Operators" explains.)
The interesting question is whether Perl 6 can slough off syntactic baggage from C and Perl 5 for the purpose of clarity and attract more new programmers. I believe the changes from regular expressions to grammars demonstrate the viability of this concept.
Indeed, and not just for the compiler's parser. I don't believe that Algol-family syntax is the best representation for source code. Nor do I believe that of S-expressions. I believe it's possible to produce a consistent syntax that's understandable and maintainable (and linguistically justifiable) for a modestly skilled practitioner of the art.
Internal consistency of Perl 6 is more important -- even to novices learning the language -- than consistency with other languages, even Perl 5. Many of the linguistic and syntactic quirks of Perl 5 came from other languages. Not all -- but many.