I love coding in Raku - and I am sure that Gleam is nice too. But I get the feeling that Raku is underappreciated / dismissed by many due to the perl5 / perl6 history. So my thinking is, when I see a new language showcase an example on their website, presumably a carefully chosen snippet that showcases their language at its best, I like to see how Raku compares to that.
You know the take-aways from the comparison are quite instructive:
- do I need to import the io lib? (shouldn't this just be included)
- do I need a main() in every script? (does this rule out one liners like `> raku -e "say 'hi'"`)
- is `io.println` quite an awkward way to spell `print`?
I am not making the case that these are right or wrong language design decisions, but I do think that they are instructive of the goals of the designers. In the case of raku its "batteries included" and a push for "baby raku" to be as gentle on new coders as eg. Python.
The differences you mentioned are advantageous for Gleam depending on what you want. Like, having to namespace symbols instead of implicitly importing symbols makes it explicit where things come from which is good. Needing main, same thing. But the big differences are that Gleam is both functional, so everything is immutable, and fully typed safe. Completely the opposite of Perl/Haku so comparing these languages makes zero sense. If you don’t need types or functional programming you probably would just never use Gleam.
I think comparing 'printing hello world' programs isn't particularly useful, except that from how you describe it, Raku sounds more like a scripting language, which Gleam is not.
In comparison with Gleam, I would be more interested to see how good Raku is at helping the programmer prevent errors through static analysis, how easy it is to build with concurrency, how much value the language puts into being easy to understand and reason about, and whether it can run on the server as well as compile to JS.
I have no negative predisposition, I don't really care about the history of pearl or whatever, I have looked at Raku before but I find the syntax very foreign, and the fact that it seems to (maybe optionally?) incorporate glyphs that I can't easily type with a keyboard.
I love the butterfly though, so I'd love to get to know the language more.
role Fish { has Str $.name }
class Starfish does Fish { has Str $.favourite-colour; }
class Jellyfish does Fish { has Bool $.jiggly }
sub handle-fish(Fish $fish) {
given $fish {
when Starfish { say .favourite-colour }
when Jellyfish { say .name }
}
}
handle-fish Starfish.new: :name("Lucy"), :favourite-colour("Pink");
I would probably reach for multi-dispatch...
role Fish { has Str $.name }
class Starfish does Fish { has Str $.favourite-colour; }
class Jellyfish does Fish { has Bool $.jiggly }
multi sub handle-fish(Starfish $fish) { say $fish.favourite-colour }
multi sub handle-fish(Jellyfish $fish) { say $fish.name }
handle-fish Starfish.new: :name("Lucy"), :favourite-colour("Pink");
I love coding in Raku - and I am sure that Gleam is nice too. But I get the feeling that Raku is underappreciated / dismissed by many due to the perl5 / perl6 history. So my thinking is, when I see a new language showcase an example on their website, presumably a carefully chosen snippet that showcases their language at its best, I like to see how Raku compares to that.
You know the take-aways from the comparison are quite instructive:
- do I need to import the io lib? (shouldn't this just be included)
- do I need a main() in every script? (does this rule out one liners like `> raku -e "say 'hi'"`)
- is `io.println` quite an awkward way to spell `print`?
I am not making the case that these are right or wrong language design decisions, but I do think that they are instructive of the goals of the designers. In the case of raku its "batteries included" and a push for "baby raku" to be as gentle on new coders as eg. Python.
The differences you mentioned are advantageous for Gleam depending on what you want. Like, having to namespace symbols instead of implicitly importing symbols makes it explicit where things come from which is good. Needing main, same thing. But the big differences are that Gleam is both functional, so everything is immutable, and fully typed safe. Completely the opposite of Perl/Haku so comparing these languages makes zero sense. If you don’t need types or functional programming you probably would just never use Gleam.
I think comparing 'printing hello world' programs isn't particularly useful, except that from how you describe it, Raku sounds more like a scripting language, which Gleam is not.
In comparison with Gleam, I would be more interested to see how good Raku is at helping the programmer prevent errors through static analysis, how easy it is to build with concurrency, how much value the language puts into being easy to understand and reason about, and whether it can run on the server as well as compile to JS.
I have no negative predisposition, I don't really care about the history of pearl or whatever, I have looked at Raku before but I find the syntax very foreign, and the fact that it seems to (maybe optionally?) incorporate glyphs that I can't easily type with a keyboard.
I love the butterfly though, so I'd love to get to know the language more.
> But I get the feeling that Raku is underappreciated / dismissed by many due to the perl5 / perl6 history.
Yes that would be me! If you like making these comparisons, can you write the following pattern matching in Raku?
sure...
I would probably reach for multi-dispatch...
1 reply →