Live data from Hacker News

A Complete Course of the Raku programming language

course.raku.org

61–70 of 110 posts

Re: A Complete Course of the Raku programming language

#62
post #20

Raku seems to be stuck in a "we'll optimise that later" dead-end, especially with string processing. Parse a large log file with a regex and compare Raku with Perl5. Raku has a long way to go.

> Raku seems to be stuck in a "we'll optimize that later" dead-end … Raku has a long way to go.

I agree that Raku still has a long way to go in terms of performance – it's not nearly as fast as it has the potential to be.

That said, I strongly disagree that Raku's performance is stuck. I've only been using Raku for about a year, but even in that time I've seen a noticeable improvement. Over a longer period, Raku has gotten dramatically faster – around a 10× improvement from the 1.0 Christmas release, depending on how you measure. For details, check out this 2019 talk where one of the lead Raku developers discusses performance gains/plans. ([0] video; [1] slides)

There's definitely still work to do (especially with regexes and grammars, as you mention). But the language has made tremendous progress, and is now in the same basic range as Python/Ruby/Perl.

[0]: https://www.youtube.com/watch?v=QNeu0wK92NE [1]: https://www.jnthn.net/papers/2019-perlcon-performance.pdf

Re: A Complete Course of the Raku programming language

#63

I literally clicked on this thinking "Neat! Let's try something new" until I remembered it's just perl rebranded... unless i'm missing something?

If you insist on comparing it to Perl, you could consider it "Perl Re-Imagined". Just like "The Lord Of The Rings" is a re-imagination of "The Hobbit".

Re: A Complete Course of the Raku programming language

#64

Is perl or "Raku" still used in serious new applications these days? I'm not talking about gluing stuff together with scripts - I mean a large project operating wholly under it

If that is your basis for evaluation, then I don't think Raku is for you.

But I think you are missing out, not just on Raku but on lots of cool stuff that is not being used "in serious applications".

There is time and place for boring tech, like when you are building a banking backend or something. But there is much more to life than churning out banking backends, and Raku is well suited for those other endeavors.

Re: A Complete Course of the Raku programming language

#65
post #8

I'm so glad they renamed Perl 6, having it dangling for decades like a Sword of Damocles hurt Perl more than anything else could. At least both languages are now able to progress in their separated ways, and I must say Raku is a really pleasant language, and a joy to use.

I'm going to butcher my question so my apologies, I've heard Perl described as a sort of linguist / grammatical type of language, where you can solve the same problem using multiple approaches and syntax. Is this something Raku is drifting from or embracing? I think Raku is kind of interesting and I did try it out a few times whilst it was called Perl 6, but I'm not sure what its niche is. I mostly do Python for prof…

As someone who wrote a limited amount of Perl 5 before writing a not insignificant amount of Perl 6 (now Raku), I find Raku syntax to be deeply Perlish while also being more modern and internally consistent than Perl 5.

IMO Raku has three standout features:

1. Grammars in the stdlib [1]

2. The absolute most flexible multi-dispatch system of any programming language [2]

3. The best regex syntax of any programming language [3]

In 2015, I had to write a DSL for a double-entry accounting system. That's when I discovered @jnthn's Perl 6 grammar debugger [4], which allowed stepping through a Perl 6 grammar line by line and visually seeing how the grammar was consuming a string. At that time I had very little programming experience, which made Perl 6 far and away the easiest way to write a custom DSL parser.

If you enjoy Erlang/Elixir multi dispatch, e.g.

    def format({:ok, %HTTPoison.Response{body: body, status_code: 200}}) do
      body
      |> Meeseeks.parse(:xml)
      |> Meeseeks.all(xpath("/*"))
      |> Enum.map(&Meeseeks.tree/1)
      |> _format
    end

    defp _format([{"current_observation", _version, current_observation}]) do
      current_observation
      |> Enum.map(&_format/1)
      |> Enum.filter(& &1)
      |> Enum.into(Map.new())
      |> Poison.encode!()
    end

    defp _format({"credit", _, [credit]}) do
      {:credit, credit}
    end

    defp _format({"credit_URL", _, [credit_url]}) do
      {:credit_url, credit_url}
    end
Raku does that in an even more flexible manner, destructuring included. I love how declarative it makes the code read.

However, I must say I've left the honeymoon phase of Raku far behind me now. In my experience, Raku grammars are insanely slow: at least as of many years ago, it was taking ~40 minutes to parse a ledger-style accounting format log file that wasn't even very big. When jnthn's grammar debugger got really buggy and less actively maintained, that defeated one of the biggest reasons I had to use the language. I've also experienced numerous bugs with Raku's type system, and just in general wouldn't write many things in Raku.

But to your question — I would write even less things in Perl 5. I have no use for Perl 5 now that Raku exists, and don't know why anyone would write Perl 5 in the modern day given how many other compelling options exist in its niche. Raku is different, and it deserves to see top caliber core development. It doesn't have that yet, and that's sad.

Frankly Raku isn't capable of replacing really any mature programming language for anything but informal scripting tasks where you don't care about speed, and where you don't need an “academic” tier type system. For those tasks, it is quite a fun language. I remain optimistic about Raku's future, and would seriously question the conventional wisdom of using Python or JS in its place for many, many things.

[1]: https://github.com/atweiden/config-toml/blob/master/lib/Conf...

[2]: https://github.com/atweiden/txn-remarshal/blob/master/lib/TX...

[3]: https://docs.raku.org/language/regexes

[4]: https://github.com/jnthn/grammar-debugger

[4]: https://vimeo.com/32044632

Re: A Complete Course of the Raku programming language

#66

Is perl or "Raku" still used in serious new applications these days? I'm not talking about gluing stuff together with scripts - I mean a large project operating wholly under it

Perl is still a common scripting language in some embedded workflows for "serious" projects, among others like TCL and Lua.

Re: A Complete Course of the Raku programming language

#67
post #8

I'm so glad they renamed Perl 6, having it dangling for decades like a Sword of Damocles hurt Perl more than anything else could. At least both languages are now able to progress in their separated ways, and I must say Raku is a really pleasant language, and a joy to use.

I'm going to butcher my question so my apologies, I've heard Perl described as a sort of linguist / grammatical type of language, where you can solve the same problem using multiple approaches and syntax. Is this something Raku is drifting from or embracing? I think Raku is kind of interesting and I did try it out a few times whilst it was called Perl 6, but I'm not sure what its niche is. I mostly do Python for prof…

a few years ago damian conway made a few talks about the raku first-class grammar objects, it kinda signals no departure from the linguistic interests of that community.

Re: A Complete Course of the Raku programming language

#68

This language looks cool! I also really like the page-by-page format for the tutorial, which strikes exactly the right balance (for me) between giving too little and too much info. As a side note, I noticed that the "Notes on using Unicode" page[1] referred to the quotation marks used in kanji-based languages[2] as "fancy." I think this kind of exotification of non-western cultures (where mundane things become exciti…

Thanks. I've updated that.

Re: A Complete Course of the Raku programming language

#70
post #63

I literally clicked on this thinking "Neat! Let's try something new" until I remembered it's just perl rebranded... unless i'm missing something?

If you insist on comparing it to Perl, you could consider it "Perl Re-Imagined". Just like "The Lord Of The Rings" is a re-imagination of "The Hobbit".

> If you insist on comparing it to Perl, you could consider it "Perl Re-Imagined". Just like "The Lord Of The Rings" is a re-imagination of "The Hobbit".

The Lord of the Rings is a sequel to The Hobbit, rather than a re-imagining. Of course there was a bit of re-imagining necessarily involved, much like the relationship between Star Trek: The Original Series and it's sequel The Next Generation.

Post reply on HN