6 ms·
I'd like to take perl6 for a spin. However, other than playing with it I'm not sure how it compares to say python or ruby in terms of strong sides. I mean what
by user9756 11y ago
I'd like to take perl6 for a spin. However, other than playing with it I'm not sure how it compares to say python or ruby in terms of strong sides. I mean what are the cases perl6 would shine in comparison? (NOT TO FLAME! I'm asking for ideas to when perl6 would be an interesting tool for the job. AFAIK it had a good string manipulation ~ also I'm still reading the tut and currently it feels very bash and somewhat ugly (although helpful) with the % & @ prefixes).
- s_kilk 11y agoA few upsides I perceive: - optional, well-integrated gradual typing system. - perl6 is the first mainstream(ish) dynamic language to not suffer from a GIL of some kind. You can do real concurrency and parallelism in perl6. - perl6 is both equally as powerful, and much more simple than previous versions of perl. - a bunch of good ideas stolen from other languages. go-routines are in there, pattern-matching, gradual typing, classes, etc. Plus, functional programming is a first-class-citizen of perl6. There's so much good stuff in there. - overall, I think perl6 has the potential to become a very powerful (and yet robust and well engineered) hacker language, where you will not be constrained by implementation details of the VM the language runs on (I'm looking at you, GIL). I'd also recommend reading Curtis Poe's answer to a similar question: https://www.quora.com/Perl-programming-language-1/Should-I-be-interested-in-Perl6 https://www.quora.com/Perl-programming-language-1/Should-I-b...
- _wmd 11y ago> - perl6 is the first mainstream(ish) dynamic language to not suffer from a GIL of some kind. You can do real concurrency and parallelism in perl6. I went digging to try and understand what this meant, and seems it's referring to syntactic support for promises, which in at least the Rakudo implementation amount to a wrapper around a forking multiprocessing system (like the Python multiprocessing module). From my perspective this concurrency isn't any more "real" than equivalents available in existing languages, but maybe I'm looking at the wrong thing - you mention global interpreter locks, and usually they refer to threading. Does some implementation of perl6 have non-GIL threading? edit: from <https://perl6advent.wordpress.com/2012/12/11/day-11-parrot-threads/> https://perl6advent.wordpress.com/2012/12/11/day-11-parrot-t...: > The solution for these problems implemented in hybrid threads is to sidestep them altogether by disallowing write access to shared variables. The programmer (or in most cases the compiler) is obliged to declare a list of all shared variables before a newly created task is started. The interpreter would then create proxy objects for these variables which the task can use to access the data. These proxies contain references to the original objects. They use these references to forward all reading vtable functions to the originals. Write access on the other hand would lead to a runtime error. > In other words, all data is owned by the thread creating it and only the owner may write to it. Other threads have only read access. > For threads to be able to communicate with their creators and other threads, they still need to write to shared variables. This is where green threads come into play. Since green threads are light weight, it is feasible for a thread to create a task just for updating a variable. This task is scheduled on the interpreter owning this variable. To reduce latency, the task is flagged to run immediately. The data-owning interpreter will preempt the currently running task and process the new write task. Put another way, the data-owning interpreter is told what to write to its variables, so other threads don’t have to.
- gpvos 11y agoGIL stands for the Global Interpreter Lock, which python has been criticized for a lot. I don't know whether perl5 or other languages have one, really.
- antoinealb 11y agoTo be fair the GIL is only an issue if you are doing CPU bound thread-based parallelism in Python. There are way to do real parallelism in Python, for example via several processes.
- jnbiche 11y ago> GIL stands for the Global Interpreter Lock, which python has been criticized for a lot. It's pretty clear the GP knows what a GIL is, he's wondering if Perl 6 is truly GIL-free, or if it "just" abstracts out the GIL using language primitives for a forking multiprocess system (already, that's a nice step, but it's not "GIL-free"). I'd like to know the same thing.
- gpvos 11y ago(Side remark: it seems the comment has been edited, expanding it a lot. It was not clear to me initially. And anyway, it is good to have acronyms expanded for other readers.)
- brrt 11y agoHi. That blog post refers to parrot vm threads, which is not what the current MoarVM or JVM implementations use. Both these VMs support 'real' OS level threads without any global locking (beyond what is needed for GC). In case of MoarVM, that support is built on libuv. And there is a very interesting high-level interface built on these fundamentals.
- iheartmemcache 11y agoLibuv is what node.js is built on, and I've seen some benchmarks of really impressive performance w/r/t MoarVM.[1]. https://github.com/perl6/mu/blob/master/examples/concurrency/stm-contend.pl https://github.com/perl6/mu/blob/master/examples/concurrency... Here is how "real" (i.e., not fake, spawn processing) concurrency is done in Perl 6. Rakudo's had more testing since it's been around forever but MoarVM is where my hopes lie. Here's hoping user adoption isn't fractured that badly like D's Tango vs Phobos debacle (which only now it's recovering from, I'd argue largely due to Andrei Alexandrescu's charismatic persona, haha.) Perl 6 is a really interesting language and I'd encourage you all to play with it, but it's an entirely different beast than Perl 5. They should have just renamed it entirely. [1] http://www.moarvm.org/features.html http://www.moarvm.org/features.html
- RHSeeger 11y ago> - perl6 is the first mainstream(ish) dynamic language to not suffer from a GIL of some kind. You can do real concurrency and parallelism in perl6. Admittedly, not everyone would define it as mainstream... but Tcl doesn't have a GIL and has had threading for a good, long time.
- dragonwriter 11y ago> - perl6 is the first mainstream(ish) dynamic language to not suffer from a GIL of some kind. GILs are features of implementations, not languages; Ruby has implementations (most notably JRuby) without a GIL. And Clojure doesn't have a GIL, and seems to be approaching mainstream. And Perl 6 isn't mainstream yet (it hopes to be, but then so do most languages.) And there's plenty of not-currently-mainstream dynamic languages without GILs in their primary implementations; many in the Lisp/Scheme family.
- cpplinuxdude 11y agoLet's not forget what perl was created for; it's a practical extraction and report language. Initially it was used to extract tables from text documents, and its always had a strong focus on text manipulation and regular expressions. Its implicit variables and syntax mean you can write very, very concise code. Yet by following stylistic guidelines of your choice, you can write code that looks sane and maintainable. I really like the fact you can import os commands and call them as a part of the language. It makes writing scripts a breeze. In fact writing anything in perl is a breeze. Check rosetta code, you'll see Perl 6 is one of the most concise at every turn. As much as I really like python, I find that calling system commands is a pain.. calling os.system is obviously far from great, and calling subprocess can get cumbersome. I haven't played with perl in a while, but my past experiences with perl was always getting a lot done, with very little work.
- pyre 11y agoJust to note that it's not all puppies and unicorns. There are a lot of low-level commands that are all tied up in different modules in Perl. Like having to remember where what you want falls into the File::* namespace... or maybe what you need is in Cwd. I worked with Perl for 4 years, and while it's not the gauntlet of pain that people make it out to be, there were several annoyances (like needing to always hit the docs for that stuff).
- cpplinuxdude 11y agoI only used it for small scripts. I'd think twice before using it for anything more significant. What did you use it for, if I may ask? What how big a project are we talking about? I would have thought hitting the docs wouldn't be a part of the annoyances list. Did you feel you had to hit the docs more than with any other language?
- awwaiid 11y agoNote, however, that Perl6 is a completely different language with a different set of standard libraries and ecosystem and pros-and-cons. You'd be as well off comparing Perl6 to Ruby as you would Perl5.
- guelo 11y agoPerl 6 continues linguist Larry Wall's vision of making a very expressive language that matches the way humans think. To me the most unique aspect is Perl 6's unicode string handling which is probably the best unicode support of any language out there. I could see it catching on in niches that need to do heavy cross-characterset text processing.