lol - I had the temerity to raise the "how about a new logo" topic last week and it's going to time time for me to (hopefully) convince the community of the need to let go
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");
Here's the other Gleam concurrency example in Raku for good measure:
my @promises;
sub MAIN() {
# Run loads of green threads, no problem
for ^200_000 {
spawn-greeter($++);
}
await Promise.allof(@promises);
}
sub spawn-greeter($i) {
@promises.push: start {
say "Hello from $i";
}
}
I made a website in HTMX (https://raku.org) to celebrate that I can use my preferred language on the server side. It’s no frills, generally static and HTMX is just to goose up some of the UX dynamism. It was a very nice experience and I recommend https://htmx.org/examples for the kind of cool things you can do. otoh, I would not build Google Maps with this tool :-)
And most users will have no idea. They just know that it's a super clean, easy to read page that conveys the message you have about Raku.
Yet the biggest benefit is for you; in 3 months or 3 years you'll return to this web site and make some changes, and you'll instantly know what's up. No super complex React / TypeScript / Node app that won't even build.
I have started gathering DSL specific content over on https://reddit.com/r/domainspecificlangs … there are several definitions over there. Personally I would distinguish between a drop down DSL and a full blown independent language.
Well, maybe. The problem is that mature languages and ecosystems are mature and new features have to be shoehorned in. Raku (https://raku.org) on the other hand is intentionally designed as a braid of sub languages (slangs) for quoting, regex, PEG, etc and you can easily make your own slang with eg. https://raku.land/zef:lizmat/Slangify so you get your DSL as a drop down language in a general PL setting.
reply