Live data from Hacker News

Unusual Raku Features

buttondown.com

41–50 of 166 posts

Re: Unusual Raku Features

#42
post #10

Earlier quoted context omitted.

> The detecting of increments has been in Perl for ages so that's not new. But this is detecting that the increment is multiplicative, rather than additive. It might seem like a natural next step, but, for example, I somewhat suspect (and definitely hope) that Raku wouldn't know that `(1, 1, 2...*)` is a (shifted) list of Fibonacci numbers.

Ah, I missed that. Nevertheless it's been in Perl6 for a while! You're safe WRT Fibonacci. > Unable to deduce arithmetic or geometric sequence from: 1,1,2

BUT WAIT!

    $ raku -e 'say (1, 1, *+* ... *)[0..10]'
    (1 1 2 3 5 8 13 21 34 55 89)

Re: Unusual Raku Features

#43
post #2

> (2,4,8...*)[17] 262144 This one genuinely surprised me

very cohesive, [7] > (1,3,9...*)[4,5] (81 243) [8] > (1,3,9...*)[(1..3)] (3 9 27) and nestable [0] > (1,2,4...*)[(1,2,4...*)[1,2,3]]

These are all very clever, but what's the use case? I'm not saying there isn't one, I just don't know what it is! Not to speak of the dead, but Perl was utilitarian: it was built to solve problems. From my point of view, these are solutions to problems I've never had.

Re: Unusual Raku Features

#44

Wow. Sign me up for leaving the industry before I ever have to maintain a Raku codebase.

Same as Perl, nobody wants to maintain it, but it's extremely fun to write. It has a lot of expression.

You can see that in Raku's ability to define keyword arguments with a shorthand (e.g. :global(:$g)' as well as assuming a value of 'True', so you can just call match(/foo/, :g) to get a global regex match). Perl has tons of this stuff too, all aimed at making the language quicker and more fun to write, but less readable for beginners.

Re: Unusual Raku Features

#45
post #8

It is absolutely mindbending to me that all of this language development has happened on top of Perl, of all things.

> It is absolutely mindbending to me that all of this language development has happened on top of Perl, of all things. Why "of all things?" The Perl philosophy of TIMTOWTDI, and Wall's interest in human-language constructs and the ways that they could influence programming-language constructs, seem to make its successor an obvious home for experiments like this.

It has the same whimsy and DWIM of perl, look at Promise having a status of 'kept' or 'broken' which is more fun than 'fulfilled' or 'rejected'. Brings to mind Perl 5's use of bless, calling the filter function 'grep' and local/global variables created with 'my' and 'our'.

Re: Unusual Raku Features

#46
post #44

Wow. Sign me up for leaving the industry before I ever have to maintain a Raku codebase.

Same as Perl, nobody wants to maintain it, but it's extremely fun to write. It has a lot of expression. You can see that in Raku's ability to define keyword arguments with a shorthand (e.g. :global(:$g)' as well as assuming a value of 'True', so you can just call match(/foo/, :g) to get a global regex match). Perl has tons of this stuff too, all aimed at making the language quicker and more fun to write, but less rea…

its not that reading perl is hard, the _intent_ of the operations of often hard/unclear.

Yes its nice to write dense fancy code, however, something very boring to write like PHP is a lot of "loop over this bucket and do something with the fish in the bucket, afterwards, take the bucket and throw it into the bucket pile" that mirrors a 'human follows these steps' type.

Re: Unusual Raku Features

#48
I implemented something similar to the compositional regular expressions feature described here for JavaScript a while ago (independently, so semantics may not be the same), and it is one of the libraries I find myself most often bringing into other projects years later. It gets you a tiny bit closer to feeling like you have a first-class parser in the language. Here is an example of implementing media type parsing with regexes using it: https://runkit.com/tolmasky/media-type-parsing-with-template...

"templated-regular-expression" on npm, GitHub: https://github.com/tolmasky/templated-regular-expression

To be clear, programming languages should just have actual parsers and you shouldn't use regular expressions for parsers. But if you ARE going to use a regular expression, man is it nice to break it up into smaller pieces.

Re: Unusual Raku Features

#50
I’ve followed this project for years, and while it’s interesting, I think it’s really a shame that Perl 6 seemed to have been so badly waylaid by this sojourn into the looking-glass.
Post reply on HN