
Ask HN: Is Perl 6 / Raku worth learning? - electricant
I have an old script updating some DNS record of mine which is buggy and starting to show its age. I have two options:<p>1) Fix it<p>2) Rewrite it and learn a new language<p>My choice was leaning towards 2). What do you think about Perl 6 &#x2F; Raku?
======
lizmat
Raku would be an excellent choice for that, because programming in Raku can be
fun, see e.g.: [https://medium.com/linux-plus-plus/linux-
may-10-2020-c095b66...](https://medium.com/linux-plus-plus/linux-
may-10-2020-c095b6650af5#e2c6)

Don't expect to be able find a full-time job in Raku just yet. But more
experienced developers will always be better paid than developers that haven't
looked beyond their side of the hill.

~~~
electricant
Thanks for the reference. I'm not looking for a job, it's just for scratching
my own itch.

------
melezhik
Definitely it's worth a shot.

You'll love the language.

It's very expressive and flexible. The community is super friendly.

If you're into more serious things, there are some projects you might like.

For example cro - framework to develop web APIs.

As for production readiness - I have used the language at my devops @job for a
couple of years.

Best.

Aleksei

------
BruceEel
Interesting and +1 to the question, what do you guys think?

I'm still planning to look into Perl 6. What I like about Perl 5.x is its high
out-of-the box availability (ie: no need to ask sysadmin to allow/install
Ruby, Node etc..), so I find ideal for some basic automation scripts.

However, I have never really managed to get used to its (Perl 5's) syntax. I
can create, initialize and iterate through a map/'hash table' in C++ without
looking up the docs. Perl... is different, I have a hard time making its
idioms stick. I am curious as to whether Perl 6 brings big changes syntax-wise
and whether I can expect it to be overall more intuitive (not in general, but
for this one programmer that is.)

~~~
b2gills

        my %hash-table = (
          abc => 1,
          def => 2,
        );
    
        for %hash-table {
          say .key, ' => ', .value;
        }
    

You can also use sub-signature deparsing.

    
    
        for %hash-table -> $ (:$key, :$value) {
          say "$key => $value"
        }
    

That may take a while to get used to.

You don't have to use it, but it is a very powerful feature so it is
definitely worth learning.

\---

Really the most difficult thing seems to be that people aren't expecting Raku
to be as consistent as it is. I think that is because most languages aren't.

For example you may expect this to work

    
    
        for @array -> $element {
          say $element
        }
    

but you wouldn't necessarily expect this to work

    
    
        if $var.method() -> $result {
          say $result
        }
    

In fact all keywords of the form `KEYWORD CONDITION {BLOCK}` will work with a
pointy block.

You can also create a lambda using the same exact pointy block syntax.

    
    
        my &multiply = -> $a, $b { $a * $b }
    
        say multiply 4, 5; # 20
    

\---

Also the signature part of a pointy block is exactly the same as a subroutine
signature, and a method signature.

You can even create an anonymous signature object.

    
    
        :( $foo, $bar )
    

(There aren't a lot of uses for it though.)

\---

I still get surprised sometimes with how consistent Raku is.

~~~
BruceEel
This is a really good explanation, thank you.

------
zubenel0
Raku is cool if you want to learn some new paradigms that other languages
might copy too. Perl would be a more suitable choice if you were looking for a
language that might be used for job search right now.

------
Nextgrid
My strategy for deciding whether a language is worth learning is to ask
yourself what problems is the language solving. My understanding is that Perl
6 has no major advantages over the other general-purpose languages and is
fairly niche and I expect it to remain so.

From a profitability standpoint, your time is better invested into getting
better at whatever language you'er currently using or learn a new language
that will give you more career opportunities. Learning a niche language that
has no major selling points over the major existing languages is a pure waste
of time that will never pay off.

~~~
lizmat
> Perl 6 has no major advantages

\- proper support for Unicode graphemes for example, a CRLF is a single
grapheme in Raku

\- lots of syntax for handling parallelisation and concurrency promises, start
blocks, react whenever, supplies

\- improved regular expressions and grammars whitespace insignificant,
grammars are subclassable modules

\- improved maintainability in production envirionments multiple versions of a
library can be installed at the same time and can be addressed from code
separately, since all imports are always lexical

To name but a few features that most other languages do _not_ have.

