Live data from Hacker News

Raku: A language for gremlins

buttondown.email

61–70 of 257 posts

Re: Raku: A language for gremlins

#61

My favorite feature of Raku: Integer division and decimal literals both return `Rat`, a rational fraction type. Even though everyone knows floats suck, nobody is actually moving away from them except Raku. If you want a float literal you specifically have to use scientific notation.

It's actually an awful misfeature, because those Rats will automatically turn into floats when the rational representation gets too big: > WHAT 1/10 (Rat) > WHAT 1/100000000000000000000 (Num) (There is FatRat, which does not so 'promote', but it is not the default.)

Ha, it's like best-effort typing. The interpreter gives you a precise rational if it can, and it throws you a float if it can't. I suppose that, in a language as dynamic as Raku, the idea is that you should never need to keep track of types anyhow, but this might be nicer if this value ends up being your user-facing output, depending on the application.

Re: Raku: A language for gremlins

#62

I sometimes idly wondered what would a programming language look like if it were filled to the brims with syntactic sugar. Now I know. It has this "it's horrifying but in a weirdly enticing kind of way, I can't make myself look away, show me more, please" kind of feeling.

Wait until you learn about Raku's Grammars.

Re: Raku: A language for gremlins

#63

Earlier quoted context omitted.

I'm not sure what I think about that. I know when to use decimal/rational types vs floats, but my own Python code has a whole lot more float() calls than Decimal()s. Floats are almost always what I want unless I'm directly working with money.

Are they almost always what you want? Like, what kind of code do you work on? I personally find, that I need floats quite rarely and rationals usually are just fine, when I write Scheme. And when I write Python, floats also don't come up that often, except for in places where I would rather like to have exact numbers than inexact ones, always making me doubt, whether what I calculate here might have too big error in…

It's mostly in calculating percentages, measuring timing, computing the interval to wait to satisfy a rate limit, that sort of thing. None of those require the extra overhead of an exact datatype in the contexts I'm using them.

Re: Raku: A language for gremlins

#64
post #61

Earlier quoted context omitted.

It's actually an awful misfeature, because those Rats will automatically turn into floats when the rational representation gets too big: > WHAT 1/10 (Rat) > WHAT 1/100000000000000000000 (Num) (There is FatRat, which does not so 'promote', but it is not the default.)

Ha, it's like best-effort typing. The interpreter gives you a precise rational if it can, and it throws you a float if it can't. I suppose that, in a language as dynamic as Raku, the idea is that you should never need to keep track of types anyhow, but this might be nicer if this value ends up being your user-facing output, depending on the application.

There is no reason why it could not continue to use the exact representation and operations if it wished (and that's what FatRat does). It's just an ill-conceived concession to performance.

Re: Raku: A language for gremlins

#65

One way you might arranging programming languages in a 2D space is with two axes: 1. How much should the language surprise you? 2. When the language does surprise you, should it delight you or horrify you? surprising ^ | | | delight horrify | | | v unsurprising Only a sadist would deliberately design a language for the top right quadrant, but there are many esoteric languages in there. I think most people tacitly ass…

I'm very interested in bottom right langs.

It's just the languages everyone knows are bad.

Re: Raku: A language for gremlins

#66
post #56

> Raku has no qualms about using Unicode operators. You check set membership with ∈. There's also ∉, ∋, and ∌. Something to note is that there are ASCII equivalents[0] for every cool Unicode operator found in Raku. For example, the equivalents for ∈, ∉, ∋, ∌ are (elem), !(elem), (cont), !(cont). [0] https://docs.raku.org/language/unicode_ascii#Other_acceptabl...

I would definitely use the ASCII versions.

Re: Raku: A language for gremlins

#67
post #39

Earlier quoted context omitted.

> arithmetic or geometric See, that doesn't delight me. OEIS is what's needed here.

Maybe there's some way to extend the compiler to use OEIS. Is there a "liboeis" that lets you download and interact with the OEIS database offline?

There's must be one or two for either Python or Perl. Well: https://github.com/sidneycadot/oeis

Re: Raku: A language for gremlins

#68

One way you might arranging programming languages in a 2D space is with two axes: 1. How much should the language surprise you? 2. When the language does surprise you, should it delight you or horrify you? surprising ^ | | | delight horrify | | | v unsurprising Only a sadist would deliberately design a language for the top right quadrant, but there are many esoteric languages in there. I think most people tacitly ass…

[deleted]

Re: Raku: A language for gremlins

#69

I sometimes idly wondered what would a programming language look like if it were filled to the brims with syntactic sugar. Now I know. It has this "it's horrifying but in a weirdly enticing kind of way, I can't make myself look away, show me more, please" kind of feeling.

You might like noulith, a hobby language written by the person who won several of the recent Advent of Code events.

The about on GitHub reads "slaps roof of [programming language]* this bad boy can fit so much [syntax sugar] into it."

They even used the language in the most recent event Advent of Code and won. https://github.com/betaveros/noulith

Re: Raku: A language for gremlins

#70

One way you might arranging programming languages in a 2D space is with two axes: 1. How much should the language surprise you? 2. When the language does surprise you, should it delight you or horrify you? surprising ^ | | | delight horrify | | | v unsurprising Only a sadist would deliberately design a language for the top right quadrant, but there are many esoteric languages in there. I think most people tacitly ass…

I mean, it was "Perl 6" so is it really surprising that Perl devs wanted a language that looks nothing like any other language? Perl has it's own healthy share of "delightful surprises" and Raku was mostly designed to eliminate perl's horrifying surprises.

Apparently by replacing them with new horrifying surprises, if this article is any indication.

Good grief, I don't miss working in Perl.

Post reply on HN