8 ms·
I hate perl6. I hate it because I tried to get involved in the project early on, and it led me down the Haskell rathole. I don't know what Haskell looks like
by Steeeve 9y ago
I hate perl6. I hate it because I tried to get involved in the project early on, and it led me down the Haskell rathole. I don't know what Haskell looks like today, but a decade or more ago it was the hardest language to pick up that I had ever experienced. It was as if I had a solid background in latin languages and I was trying to pick up Chinese based on a handful of tutorials written by a tourist on the back of a napkin.
But it has been a decade and I am truly impressed with what it has turned into. Unfortunately, it has to re-gain mindshare as if it was starting from scratch. It might be a little bit harder actually, because there are a variety of scripting languages these days that are easy to learn, and there are still more than a few people who actively don't like Perl.
I really liked this slideshow: http://tpm2016.zoffix.com/#/ http://tpm2016.zoffix.com/#/
It gives a good review of Perl6 from early 2016. The video is an hour and a half, but it only takes a few minutes to scan through the slides and find the interesting pieces. (left and right arrow to navigate the slides)
- txdv 9y agoI looked quickly through the slides and saw that perl has now grammar build in the language... Truly an interesting feature
- perlgeek 9y agoIt is. You can build recursive descending parsers with a declarative syntax, and all the benefits from having it in OO (role composition, inheritance). Here is a working grammar for INI config files: https://github.com/tadzik/perl6-Config-INI/blob/master/lib/Config/INI.pm#L5 https://github.com/tadzik/perl6-Config-INI/blob/master/lib/C...
- dmytrish 9y agoIs the language itself a good place for parsing/grammar handling? I could not even find in the standard documentation which kind of parsers it supports, is it LR(k)? LL(k)? Any CFG? What parsing method does it use: recursive descent, shift-reduce, something more general like CYK/Earley algorithms? How does it handle ambiguities? It turns out that `grammar` keyword generates recursive descent parsers and anything even a bit fancier still requires a dedicated parsing library.
- riffraff 9y agoperl6 grammars have to be seen in context of perl5 regexp. Basically, regular expressions have grown to impossible to understand, write and modify. Mostly due to perl. Yet, they are used daily by millions of developers, because they are a ton better than manual character checks. Perl6 grammars are basically an attempt to bring developers another step forward.
- vram22 9y agoAre you saying that Perl6 grammars are a replacement (maybe eventually) for Perl5 regexps?
- riffraff 9y agopartly, you still build Grammars out of "token", "regex" and "rule" definitions, but some things are more natural with one or the other. So, if you are doing "test if string has whitespace" you'd use a regex, while for "parse an apache log line" you'd probably use a grammar instead of a very nasty regex. IANA perl6 dev though, just a casual observer.
- kbenson 9y ago> while for "parse an apache log line" you'd probably use a grammar instead of a very nasty regex. That's actually a fairly easy endeavor with perl regex capabilities, especially named captures. Parsing HTML, or a programming language, or other much more complex structures is much easier with a grammar. For example, JSON parsing[1]. That said, there are ways to approximate some features of grammars with Perl5 regexes[2]. 1: https://github.com/moritz/json/blob/master/lib/JSON/Tiny/Grammar.pm https://github.com/moritz/json/blob/master/lib/JSON/Tiny/Gra... 2: http://blogs.perl.org/users/brian_d_foy/2013/10/parsing-json-with-a-single-regex.html http://blogs.perl.org/users/brian_d_foy/2013/10/parsing-json...
- vram22 9y agoThanks, riffraff and kbenson.
- throwaway7645 9y agoThere is an old (infoq? I think) presentation with Damian Conway where he calls it a new paradigm "grammar based programming" where you write a grammar parser object easily using the built-in functionality and then add a little code to get with it and BAM you're finished. I think this elegantly solves quite a few programming tasks of mine.
- riffraff 9y ago> and it led me down the Haskell rathole. was this through pugs? To this day, I think the days of pugs development and "commit bit to everyone" where the most fun I've seen in open source.
- Steeeve 9y agoIt was pugs, and it was pretty fun.
- throwaway7645 9y agoPerl6 is no longer implemented in Haskell on the backend. I think the old parrot VM was, but MoarVM is in C. On the bright side, a lot of cool FP concepts made it into P6 as a result of the original Haskell backend, so useful cross polination happened. Even better, you can do FP stuff in a much easier to understand way and you can also mix in OO when needed or relevant.
- kbenson 9y ago> Perl6 is no longer implemented in Haskell on the backend. I think the old parrot VM was Parrot was implemented in C, and to my recollection implemented various iterations of bytecode syntaxes, notably PBC (parrot byte code). Rakudo Perl 6 developers took the route of developing Perl 6 through an intermediary language NQP, which is a language aimed at making it easy to implement interpreted languages. Rakudo (the implementation of Perl 6 that run on MoarVM) is implemented in NQP, and started out on Parrot through an implemention of NQP for Parrot. NQP[1] stands for Not Quite Perl, and shares various features with Perl, but is much more constrained in features as capabilities, making it easier to implement in a VM. Because it's mostly implemented in NQP, it's fairly easy to port to a new VM, as all you have to do is get NQP running on that VM, and Perl 6 is mostly ported. For example, this is how the Java port happened within a few months of announcement. NQP was implemented, and then 95% of Perl 6 was already working. When a new VM instead of Parrot was desired, MoarVM was conceived of as a VM to natively run NQP (rather than NQP on top of the native VM bytecode). Porting Rakudo to it was relatively easy, since Rakudo targets NQP, not a specific VM. Pugs, conversely, was an interpreter/VM for Perl back in the days of Parrot, and ran its own Perl 6 implementation directly (no intermediary language, and it wasn't Rakudo). It was writtem in Haskell. Niecza was another direct implementation of Perl 6, but implemented in C# for .Net. I don't believe it used NQP. 1: https://github.com/perl6/nqp https://github.com/perl6/nqp
- cygx 9y agoParrot was implemented in C, and to my recollection implemented various iterations of bytecode syntaxes, notably PBC PBC was the bytecode format, the human readable low-level syntax was called PASM and the slightly higher-level synax was called PIR. Besides PIR, other languages still close to the metal were NQP versions (though I don't remember the exact relationship between NQP/NQP-rx/parrot-nqp) and eventually Winxed.
- krylon 9y agoFWIW, I, too, have tried learning Haskell and ended up banging my head against the wall over and over. With Lisp, I eventually "got it", but Haskell has evaded my attempts at understanding it with impressive stubbornness[1]. Disclaimer: I do not hate Haskell, I just don't "get it". If you love the language, fine, have as much fun with it as you possibly can. I for one have given up, at least for now. Maybe I'll try again next year. [1] NB that the word "stubbornness" has three pairs of double consonants. How fun is that?
- seagreen 9y agoHaskell's rough to learn because it hits you with purity, category theory inspired typeclasses, and laziness all at once. It's natural that people struggle with this (I sure did). If you feel like trying a pure language again someday you could consider PureScript (which just has the first 2 things above) or Elm (which just has the 1st). If you do try I'd like to hear how it goes, email in profile.
- krylon 9y agoMy main problem with Haskell was not the pure, funcational part. It was the side-effect-laden part. If I were ever to go there again, I would probably give OCaml a try. It seems to offer many of the benefits of Haskell, while also offering "a way out" into the familiar world of objects and side effects. But don't hold your breath, I don't think I will get there this year.
- hardwaresofton 9y agoWhat do you mean by the "side-effect-laden" part? Did you find yourself writing lots of side effecting code because of Haskell (which seems weird)? Or Haskell just wasn't a good fit for a project that was full of side-effecting code? If it's the latter, I can definitely tell you that part of the zen of Haskell is firming up the boundaries between side-effecting code and pure code -- for example, IMHO the better you get at Haskell, the less `do` statements show up in your code (for better or for worse, because >>=, <*>, and co make it harder for newcomers to enter a codebase)
- hardwaresofton 9y agoThe Haskell introductory landscape has definitely changed. Learn You A Haskell for great good (http://learnyouahaskell.com http://learnyouahaskell.com) is an excellent introductory book to read to get started with Haskell. A drier but more in-depth read is http://book.realworldhaskell.org/ http://book.realworldhaskell.org/ Also, when you hit monads again, the best advice I can give you to understanding them (99% of Haskell guides out there seem to be about monads) is to take this path: Functors -> Applicatives -> Monads And check out this link: http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html http://adit.io/posts/2013-04-17-functors,_applicatives,_and_... I'm not sure those resources were around when last you tried haskell, but they're worth giving a read. Haskell has M:N threading, and a strictness about types and semantics that's very refreshing to me. Yes, I could have written my most recent web project in some other language that would have been quicker (because it would have been simpler and likely more imperative), but I trust my codebase so much more with Haskell. Ironically it's my own understanding and clarity of thinking that I sometimes doubt now, but that's a good problem as far as I'm concerned, makes me think clearer. [EDIT] - Can't believe I forgot, but Erik Meijer's series on Haskell is actually one of the first resources that actually got me really into it, it is absolutely fantastic, I actually watched the whole series before I read learn you a Haskell. https://channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-Functional-Programming-Fundamentals/Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1 https://channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-Fun...
- jabl 9y agoI'm learning myself some Haskell (so I'm far from an expert, so take this with a grain of salt...), but AFAIK the current recommended introductory resources are described here: https://github.com/bitemyapp/learnhaskell https://github.com/bitemyapp/learnhaskell tl;dr: 1) If you want to buy a book, http://haskellbook.com/ http://haskellbook.com/ is supposed to be good 2) If you instead want to learn from free online sources, a) cis194 spring 2013 followed by b) The data61 course (links in the github link above).
- bulldoa 9y agoI am always curious why monad is important in functional language, isn't it accurate to say that monad is just a wrapper class?