5 ms·
What you can write in Perl 6 today
- blue1 18y agoWhen 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.
- jcapote 18y agoI'd upvote you twice if I could; regularity ftw
- utx00 18y agowow. 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 ...)
- kingkongrevenge 18y ago> 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.
- utx00 18y agoit is less to type, yes. it is not conceptually shorter; not to me at any rate. so if it works for you, great.
- gamache 18y agoI modded you down because you told me to, twice.
- utx00 18y agoha! ok. fair enough.
- jrockway 18y agoWait, 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.
- utx00 18y agodifferent 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' ... i'm tired already.
- shrughes 18y agoMy 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.
- kingkongrevenge 18y agoOperators operate on the list. Conditions test the list. How is that confusing?
- shrughes 18y agoIt'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.
- kingkongrevenge 18y agoIsn't this like complaining that '[how the hell do you escape two asterisks?]' for exponentiation is too confusing?
- shrughes 18y agoYou're not reading what I've said, are you.
- utx00 18y agoyeah. 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)
- 18y ago
- marcusbooster 18y agoWhatever 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.
- chanux 18y agoEnough serious talk.. have a little break http://xkcd.com/224/ http://xkcd.com/224/
- snorkel 18y agoIt 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.
- chromatic 18y agoPerl 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.
- snorkel 18y agoI'm sorry but if every programming language out there uses ?: then that's not ambiguous at all.
- scott_s 18y agoPerhaps he meant the ambiguity of parsing?
- chromatic 18y agoIndeed, 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.