[HN Gopher] A Complete Course of the Raku programming language
___________________________________________________________________
A Complete Course of the Raku programming language
Author : domm_plix
Score : 132 points
Date : 2021-01-14 12:44 UTC (10 hours ago)
(HTM) web link (course.raku.org)
(TXT) w3m dump (course.raku.org)
| 7thaccount wrote:
| Raku is a seriously cool programming language, but it is still
| not at the level to where I'll put in learning effort past all
| the tutorials I've read in the past. When it reaches maturity, I
| could see myself using it in some hobby projects. It seems like
| it has a good bit of the power you see in languages like
| Smalltalk, but in a more accessible package.
| donaldihunter wrote:
| I haven't used Raku for anything big, but I do use it for a lot
| of small projects. I find the expressiveness great and I can
| get things done with minimum fuss. It's especially good for
| command-line tools where a MAIN function gives a CLI with
| parameters and autogenerated usage.
| aeturnum wrote:
| 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 exciting or
| "fancy" because it's not from your culture) can be a kind of
| cultural "code smell" that warns off non-western developers. Even
| if it comes from a humorous or enthusiastic place, an outsider
| just sees someone getting weirdly excited about a normal thing.
|
| [1] https://course.raku.org/essentials/on-unicode/
|
| [2] https://en.wiktionary.org/wiki/%E3%80%8C_%E3%80%8D
| donaldihunter wrote:
| That is useful feedback. As far as I know, Raku docs have
| changed in the past to remove cultural in-jokes or smells.
| amelius wrote:
| My first question whenever a new programming language comes up:
| does it solve the problem of "what color is your function"? [1]
|
| [1] https://journal.stuffwithstuff.com/2015/02/01/what-color-
| is-...
| bmn__ wrote:
| Yes, unlike the languages mentioned in TFA, it just works.
| Specifically, you can `await` anywhere without the requirement
| of declaring the surrounding context as async which in practice
| means you eliminate the red/blue distinction.
| [deleted]
| richardwhiuk wrote:
| I think Java does have coloured functions. It's just that the
| colours are "fast" and "slow" - i.e. functions which will block
| the thread for a long time and those which don't.
|
| You can't call "functions that may block for a long time" from
| a UI thread. Java doesn't have async, so you have to punt them
| to a background thread manually.
| VeronicaX11 wrote:
| 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?
| lizmat wrote:
| 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".
| youdontlisten wrote:
| Look, Larry, give it up, OK? Nobody is going to use Perl 6. There
| are a million other languages out there these days. What does
| your language do that is in any way special or unique? Nothing.
|
| Needless to say, the name Perl has little cachet or relevance
| today, thus explaining the name change. Lipstick on a pig.
|
| At this point, if a supposed 'alternative' can't replace the C
| language, I want nothing to do with it. We need to get back to
| the hardware. No, Go doesn't cut it, and ( _laugh track
| deafening_ ) I'm not interested in Rust, either.
|
| I think the very idea of a VM language, while a cool and fun toy
| back in the early 2000s, is losing its relevance, at least for
| the moment. Source code portability is much better than binary
| portability.
| jonny383 wrote:
| 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
| mfontani wrote:
| There are many Perl projects used in serious applications.
| Here's a few:
|
| https://www.rexify.org/ -- an automation framework
|
| https://mojolicious.org/ -- amazing web framework
|
| https://metacpan.org/pod/DBIx::Class::Manual - amazing ORM
| sumnole wrote:
| Perl is still a common scripting language in some embedded
| workflows for "serious" projects, among others like TCL and
| Lua.
| gamache wrote:
| Short answer: no, Perl is a very rare choice for starting a
| "serious new application", and Raku's even further off.
|
| In Perl's case, it's not that the production-ready libraries
| and frameworks aren't there -- they are, and they are fast and
| stable and in some cases _very_ sophisticated -- but simply
| that the community of developers likely to start a "serious
| new application" has passed Perl by for more modern (e.g.,
| Rust, Elixir, Kotlin, Go even if its ideas are old) or
| ubiquitious (e.g. JS, Python) choices.
|
| In Raku's case, there is not a deep bench of libraries and
| tools suitable for production.
|
| In both cases, hiring for previous knowledge is not practical.
| jjjbokma wrote:
| Does a static microblog generator[0] count as serious? I use it
| for my own, mostly linkblog [1].
|
| [0] https://github.com/john-bokma/tumblelog
|
| [1] https://plurrrr.com/
| zokier wrote:
| 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.
| tyingq wrote:
| Not many, but yes, there are examples. Booking.com is one. Or a
| smaller example, the web admin interfaces and REST API server
| for Proxmox is Perl.
| heresie-dabord wrote:
| > used in serious new applications these days?
|
| Unpack this for us... Do you mean _commercial_ applications? If
| so, you can determine for yourself the small number of
| languages used for "serious applications".
|
| If you mean data analysis, ETL, system administration, and
| general data reconstruction, I can't think of a faster, more
| appropriate language than Perl. Sed and awk are also powerful
| mainstays.
| krylon wrote:
| So far I have found the lack of good tutorials my main roadblock
| towards learning Raku. I am looking forward to spending the
| weekend working my way through this.
| anewaccount2021 wrote:
| LearnXinYminutes has a great tutorial. The main raku.org site
| already has incredible docs.
| ReallyOldLurker wrote:
| There is an AppImage that you can try out if you don't want to do
| a full compiler, etc. download and install.
| https://github.com/timo/rakudo-appimage
| msvan wrote:
| Over the years I have learned and dipped my toes in many
| programming languages, and I'd need some kind of reason to look
| into yet another language. What are Raku's main contributions to
| the programming language design space that I probably haven't
| seen elsewhere?
| anewaccount2021 wrote:
| Raku incorporates many of the neatest ideas in languages but
| retains a perlish flavor. I would almost equate it with Racket,
| in that there is support for many styles of coding, and your
| code may look nothing like another's. TMTOWTDI is fundamental
| to the perl philosophy so if you prefer total consistency, you
| are probably better off with python or go.
| cutler wrote:
| Hyperoperators by The Damian.
| tsjq wrote:
| It is Perl
| donaldihunter wrote:
| Gradual / optional type declaration, grammars as a first class
| language feature, async / parallel programming, rational
| numbers, lazy evaluation, OOP with classes and roles and an
| underlying metaobject protocol.
| olah_1 wrote:
| The real bummer about optional typing is that it doesn't
| speed up the program. I used it all over thinking that I was
| "optimizing" or helping the compiler. Really I was creating
| more work for it.
| donaldihunter wrote:
| The goal is definitely that it _can_ enable greater
| optimisation and I agree that it 's not a reality yet. The
| other benefit is that it constrains types so that you get
| compile time type checking, which is very useful.
| jinpa_zangpo wrote:
| Rational numbers instead of floating point as the default real
| type.
| db48x wrote:
| That's not exactly a new innovation though; Lisp has had a
| whole numeric tower for a few decades now...
| [deleted]
| sigzero wrote:
| Maybe grammars? You'd have to research.
|
| https://docs.raku.org/language/grammars
| metreo wrote:
| Overall this seems like a fitting outcome for both projects, it
| certainly gives what it now Perl7 a sense of momentum and
| freshness as far as discussions around some of the direction
| being taken by Raku (nee Perl6). Huge thanks to everyone
| involved.
| qalmakka wrote:
| 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.
| giancarlostoro wrote:
| 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 professional
| projects but don't mind experimenting with other languages.
|
| I guess what I'm trying to ask is what are the major
| fundamental differences between the two languages? Features
| aside, although if some features are part of the answer thats
| fine.
| codesections wrote:
| > 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?
|
| Very much embracing - "turning up to 11" might be a better
| way to put it. I recently wrote a three-part blog series[0]
| about what Raku's primary values, and the more-than-one-way-
| to-do-it idea features prominently in that list.
|
| [0]: https://www.codesections.com/blog/raku-manifesto/
| atweiden wrote:
| 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
| agumonkey wrote:
| 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.
| donaldihunter wrote:
| Raku definitely embraces multiple approaches and syntax,
| continuing the "There is more than one way to do it" motto of
| Perl. In addition, Raku aims for consistency and
| composability while introducing new language constructs like
| laziness, gather/take, async/await, hyper operators, grammars
| and more.
| wolco5 wrote:
| Not sure Raku was the best choice.
|
| I initially thought this was about the programming language for
| roku and was a little disappointed it was about perl 6 changing
| names.
| sigzero wrote:
| Agreed. Now both projects can more forward for whatever
| someone's definition of forward means. I am just glad it
| happened.
| huhtenberg wrote:
| Is there a one-page version of this? Or at least with support for
| - and - keys for page navigation.
|
| It's basically impossible to skim this course or to jump around
| it quickly.
|
| Edit - here's a GreaseMonkey script for the arrow navigation
| between the pages. Right arrow - next page, Left arrow - previous
| page. https://pastebin.com/uQMWyfq0
| andredz wrote:
| Thank you very much; works great.
| easygenes wrote:
| Sadly only first part is complete. Raku is the much more
| functionally inspired new Perl. It's the renaming of Perl 6 and
| means "camel" or "paradise" in Japanese.
| vanderZwan wrote:
| Given the sense of humor the Raku devs seem to have, I'm
| surprised they didn't call it an incomplete complete course (as
| a working title)
| StylusEater wrote:
| Looks like people can submit PRs: https://github.com/ash/raku-
| course
| [deleted]
| sigzero wrote:
| The good thing is that it is under a grant to get the work
| done. Should be interesting to watch it get fleshed out.
| zeotroph wrote:
| Also I'd prefer more than one subheading per page. That would
| make scrolling/wheeling through the content easier.
| qsort wrote:
| Is Perl/Raku widely used these days? Are they worth learning?
| I've always been curious about those languages but I've had the
| impression that people are moving away from them.
| megameter wrote:
| Raku is crammed with enough good, original ideas about
| programming languages that I would compare it to the
| "learning Lisp" meme in that it will probably reveal
| something new to you.
|
| But as for usage, it's mostly legacy Perl codebases, which
| are much less interesting - Python and Ruby basically cover
| the same bases.
| pram wrote:
| In general no, but between the two: Raku is essentially used
| in nothing, so your time would be better spent learning Perl.
| dunefox wrote:
| > Raku is essentially used in nothing, so your time would
| be better spent learning Perl.
|
| Only if your goal is to be able to work on legacy
| codebases. Learning a cool language in itself is cool.
| mempko wrote:
| We use Raku for various things. For example, generating job
| workflows. It has an amazing type and object system.
| thesuperbigfrog wrote:
| Learning Perl is worthwhile because it is ubiquitous on Unix-
| like systems and Perl-compatible regular expressions are the
| defacto standard regular expression syntax.
|
| Perl may not be as popular now as it was in the past, but it
| is still around and lots of legacy systems that were written
| in Perl are still in active use.
| pvorb wrote:
| But as Perl-compatible regular expressions are available in
| many other languages, this is not really a reason for
| learning Perl itself, right? Or am I missing some deeper
| insight into regexes, because I don't know Perl?
| wxkn wrote:
| That's true, but it's worth mentioning that using the
| regexes in perl is quick and even fun to write. They are
| built-in to the language. some people find it very
| convenient.
| anewaccount2021 wrote:
| I use both every day. The core perl5 packages I rely on are
| updated regularly. The perl5 runtime is released on a
| reliable schedule. Everything works.
|
| I use raku mostly for fun. It has come a long way. It has
| further to go, but I don't mind. There is a surprising amount
| of vital packages already available for getting things done.
|
| I don't think anyone believes perl5 will be as popular as it
| was years ago, or that raku will be a top-five language, but
| who cares? As long as the core community persists, its
| enough.
| [deleted]
| krupan wrote:
| Really, probably not. Perl was mind blowing, productive, and
| super fun when your only other choices were C/C++ and
| bash/sed/awk. Most people eventually realized that There's
| More Than One Way To Do It makes for code maintenance
| nightmares.
| greydius wrote:
| Camel is rakuda. Raku means easy, comfortable, without trouble,
| etc.
| cutler wrote:
| 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.
| space_ghost wrote:
| Raku also suffers from a lack of ecosystem. Perl5 and Node have
| huge advantages there.
| codesections wrote:
| > 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 10x
| 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
| unixhero wrote:
| Learn Perl6 in one video:
| https://www.youtube.com/watch?v=l0zPwhgWTgM
|
| This guy is so amazing. Mad props to him.
___________________________________________________________________
(page generated 2021-01-14 23:01 UTC)