Hacker News new | past | comments | ask | show | jobs | submit login

I dream of a day where one can post a Raku article on HNN and not encounter a comments section full of digressions into discussing Perl.

There is some sense to it by means of comparison, but the constant conflation of the two becomes tiresome.

But in that spirit, let's compare:

The =()= "operator" is really a combination of Perl syntax[^1] that achieves the goal of converting list context to scalar context. This isn't necessary to determine the length of an array (`my $elems = @array` or, in favor of being more explicity, `my $elems = 0+@array`). It is, however, useful in Perl for the counting of more complex list contexts on the RHS.

Let's use some examples from it's documentation to compare to Raku.

Perl:

    my $n =()= "abababab" =~ /a/g;
    # $n == 4
Raku:

    my $n = +("abababab" ~~ m:g/'a'/);
    # $n == 4
    # Alternatively...
    my $n = ("abababab" ~~ m:g/'a'/).elems;
That's it. `+` / `.elems` are literally all you ever need to know for gathering a count of elements. The quotes around 'a' in the regex are optional but I always use them because I appreciate denoting which characters are literal in regexes (Note also that the regex uses the pair syntax mentioned in OP via `m:g`. Additional flags are provided as pairs, eg `m:g:i`).

Another example.

Perl:

    my $count =()= split /:/, "ab:ab:ab";
    # $count == 3
Raku:

    my $count = +"ab:ab:ab".split(':');
    # $count == 3
    
While precedence can at times be a conceptual hindrance, it's also nice to save some parentheses where it is possible and legible to do so. Opinions differ on these points, of course. Note also that `Str.split` can take string literals as well as regexes.

[1]: See https://github.com/book/perlsecret/blob/master/lib/perlsecre...




> digressions into discussing Perl

Changing the name to Raku doesn't obliterate Perl 6's history as Larry Wall's successor to Perl 5.

I don't know why you would expect people to pretend that they're unrelated. They aren't.


To me it’s not unlike spending all of a thread about Clojure commenting on Java or Common Lisp without even bothering to mention or contrast to Clojure.

There are connections to both but that doesn’t necessarily make them topical.

I disagree that discussing a previous language by a designer (often in terms that seem to conflate equivalence) is usefully relevant to discussion of a different language by that designer.

Note that I have never said that there is zero utility. I just find it tiresome to encounter comments about Perl syntax as if it is automatically useful or interesting to discussions about Raku.

Which is why I took the time to provide an example of what (I would consider) an actually relevant mention of Perl syntax.


> Changing the name to Raku doesn't obliterate Perl 6's history as Larry Wall's successor to Perl 5.

Further than that, the name change only happened after it already had at least one official release under the "Perl 6" name.


It was just as annoying to constantly be pulled into discussions about Perl 5 in threads about Perl 6 back then too.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: