7 ms·
Why Perl 6 is Different (2010)
- brudgers 11y agoPast: https://news.ycombinator.com/item?id=1279238 https://news.ycombinator.com/item?id=1279238
- mback00 11y agoIt is still... A language for the quick hack, but not for the reader (or author) to understand a day or even an hour after the writing.
- mhd 11y agoIt's an Algol-based language. I never quite got what people "got wrong" with Perl code. Yes, I've seen bad examples, but those would've looked pretty much the same in C, Pascal or Python (deep nesting, bad names, overuse of regexps). Back in the days one argument was using "grep" or "map" instead of explicit for-loops, but in this day of functional programming, that would seem a weird criticism. Is it the type glyphs? ($%@) References are a bit unnecessary, yes.
- hugs 11y agoYes, it's the type glyphs. (For me, at least.) Back when I was a DBA writing database back-up scripts in Perl, I could never remember how to dereference a value in an array or hash properly. (It reminded me of my problem with pointer notation syntax in C). When I first saw Python, I thought "Wow, it's like Perl, but without the confusing notation." I rewrote the scripts in Python and never looked back.
- raiph 11y ago> I could never remember how to dereference a value in an array or hash properly. I too struggled with that and came to hate it. Perl 6 directly addressed this and some related problems. First, sigils are now invariant - they're just a part of the name that signals which of the three data structure types a particular variable is. Second, there's no need for a `->` dereferencing op. my @array = 1,2,3; # `@` sigil means indexable var say @array[1]; # prints 2 It might be interesting to look at an example. Perhaps you could share an example of code in Python that illustrates some data structuring code that would be confusing in Perl 5 syntax, I'll try show what the Perl 6 equivalent would be, and we can see if Perl 6 really does clean this part of the language up.
- collyw 11y agoNested arrays are a pain on the arse in Python. Do I use extend or append? Then strings are treated as character arrays. I far preferred Perl's approach where you would reference or dereference variables instead.
- realusername 11y agoThat's the number one reason I don't code in Perl, I can't even read my own code 6 months later... Perl is not a programming language, it's closer to real languages and you can sort of invent stuff and it works...
- dozzie 11y agoThen you're doing it wrong. Do you write in the same manner in other languages, too?
- lmm 11y agoI can write readable Perl by writing it as if it were Python, adding extra braces where required, a couple of use declarations at the top, and wrapping some system functions with clearer names. But if that's what you want then it's easier to just write Python. Perl's USPs like regex literals and $_ rely on you writing in an unreadable style.
- Mithaldu 11y agoGot some examples of your Perl?
- lmm 11y agoAfraid not - I only ever wrote Perl for employers, for my personal projects I used Python.
- dozzie 11y agoSo, Python regexps are suddenly more readable, even though they need additional layer of backslashes? $_ does not rely on unreadable style. First, it's a common idiom, so it's in no way less comprehensible than list comprehension in Python. You just need to understand what it means. Second, it's not an obligation to use $_. I often avoid it if it doesn't make my code reflecting my intentions better. Funny thing, I do the same in Python, C, and Erlang. And I hear about $_ and regexp literals as unique selling points (if I read your acronym correctly) only from people that don't really write in Perl.
- kqr 11y agoThis is because it was invented to be possible to use as an interactive shell. When you're working with an interactive shell, you want its language to be (at least somewhat) optimised for writeability, which by necessity means a lack of optimisation for readability. (Explicitness and some level of redundancy aid readability but hurt writeability.)
- dalke 11y agoI believe Perl was meant as a replacement for shell scripts, as well as sed and awk script. It wasn't designed as a interactive shell. For example, the original perl man page says (quoting from http://history.perl.org/PerlTimeline.html http://history.perl.org/PerlTimeline.html ): Perl is a interpreted language optimized for scanning arbi- trary text files, extracting information from those text files, and printing reports based on that information. It's also a good language for many system management tasks. The language is intended to be practical (easy to use, effi- cient, complete) rather than beautiful (tiny, elegant, minimal). It combines (in the author's opinion, anyway) some of the best features of C, sed, awk, and sh, so people familiar with those languages should have little difficulty with it. The closest that perl had to an interactive shell was with the "-d" debugger. See for example this synopsis from 2007 at http://archive.oreilly.com/pub/post/writing_a_modern_perl_repl.html http://archive.oreilly.com/pub/post/writing_a_modern_perl_re... : > One area in which Perl falls behind other languages is in its lack of a usable Read-Evaluate-Print-Loop. (perl -de 0 just isn't enough for me.) I've used Ruby's irb and a handful of Python shells, and I'm starting to become a fan of ghci, but I fall back on perl -e far too often for my sanity. An interactive shell should, in my opinion, support more than a REPL. It should also implement job control, like suspending a job or starting jobs in the background. Perl definitely was not invented for that purpose.
- collyw 11y agoI have seen just as much crappy unreadable Python in the wild.
- grabcocque 11y agoOne of Perl 6's original design goals was that it should "still be Perl". In that sense, I think it's a failure. Aside from a superficial syntactical resemblance, it really doesn't feel much like my beloved Perl 5 at all. Its semantics are very different. It also seems to suffer from an advanced (possibly fatal) symbolpasta diarrhoea. Perl 5 was not pretty, but Perl 6 at times can be downright hideous. If Perl 6 is a Lisp, that's great! You know, I am deeply and madly in love with Clojure at the moment. But that manages to be a Lisp without falling even deeper into the line noise trap than P5 did. But, you know, syntax is just syntax.
- Mithaldu 11y ago> Perl 5 was not pretty Beauty is in the eye of the beholder. I won't bore you with the details, but rest assured that there are many others like me, who appreciate Perl 5 both for its aesthetics, and are able to use the technical consequences of said aesthetics for productivity.
- chrisseaton 11y agoYou're right that it's subjective, but I think it's true to say that the most commonly appreciated programming language aesthetic has shifted since Perl 6 started to when it delivered. Back then many programmers appreciated the whimsical, pseudo natural-language nature of Perl. These days I don't think that style is as fashionable amongst most programmers and purity and straight-forwardness is more appreciated. Perl 6 is going to lose out because of that.
- crncosta 11y agoI like P6 syntax and semantic more them P5. My only one problem about P6 is the fact they dropped the effort of having the specification so others can implement the language too. Looks like they prefer a conformance test instead of a formal/complete specification. While that is perfect fine, I would say having both the test and the spec is even better, for those trying to learn and implement the language. A good, formal and complete specification will make my learning process much better, IMHO.
- simgidacav 11y agoThis post sounds a bit like trolling :D However, I believe the real power of Perl, besides the obviously awesome regex handling, is the "huffmann" principle of making common things super-quick. Sure this is the major cause of read-only code, but it's also the reason why I use perl every time I just need things to be done. In Perl6 they kept this principle in mind, and this is the important part IMHO.
- ceronman 11y ago> Perl 6 is Lisp with a perly syntax Lisp syntax is super simple. But this simple syntax can hide an enormous complexity. Metaprogramming is complex. Lisp is so powerful, but it's not so widely used as other languages because of this complexity. Now, Perl 6 claims to have the same power as lisp, only that instead of using a simple syntax, it is using a complex one, and a complex way of modifying that syntax. This is complexity wrapped in more complexity. I'm sorry but I don't think Perl 6 will ever be a very widely used programming language as its predecessor was. It might however amuse a small group of hackers who want to test new ideas in programming languages.
- raiph 11y agoDid you use more than logic to arrive at your conclusion, e.g. did you spend a while having fun, or at least trying to have fun, coding with Perl 6 before you reluctantly concluded it wasn't going to work out or did it never really appeal in that way to you in the first place?
- ceronman 11y agoI've in fact been playing with Perl 6. First a year ago, and then again when it was released. I've found and reported bugs. And I do think it has very powerful features. But hell it's hard to learn and very complex in my opinion.
- raiph 11y agoThanks. It's good to hear that you've tried to enjoy it and drawn conclusions from that experience. Imo Perl 6 has some easy on ramps and then a long and winding learning road that can be tiring to navigate due to pot holes, inadequate doc and tools, and lots of yak shaving. I wonder if you agree that bugs, weak doc, and an immature ecosystem and tooling are a significant contributor to the toll exacted by the long (endless?) learning curve? Also, if you've used and liked Perl 5 I'd be interested in your opinions about how you think the relationship of the two Perls will evolve.
- brudgers 11y ago
- angvp 11y agoNo perl 6 is still a crap like perl5, drop it.
- dang 11y ago> No perl 6 is still a crap like perl5, drop it. Flamewar comments like this break the HN guidelines. Please post civilly and substantively, or not at all. https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html