Hacker News new | ask | show | jobs
by dale_glass 1488 days ago
I think more than anything it was an error in the messaging.

Perl 6 was treated as the successor of Perl 5 -- and that was the mistake. It meant Perl 5 started dying, since people assumed that Perl 5 would be soon dead, and Perl 6 had a new different syntax. And then it took 15 years to happen, during which Python and others ate its lunch.

I think a more successful strategy would have been to make it clear very early on that Perl 6 would be some sort of long term experimental project, and that Perl 5 would be expected to be a thing for a long time still.

If in 2015 Perl 5 still had a thriving ecosystem, and there was a demand of Perl-like but better, then Perl 6 could have been more successful. But in the current timeline it's a successor to an almost defunct language, and isn't such an attractive proposition.

2 comments

> Perl 6 was treated as the successor of Perl 5

In 2000, for all intents and purposes, Perl 6 was the successor of Perl 5. And one of the reasons the project was started, was because Perl 5 was already dying at that point. Not only losing the web server competition to PHP, but also from internal battles, close to civil war.

The internal battles ceased for a while when the Perl 6 process was started. But around 2008, it became a war between Perl 5 and Perl 6. To squelch that, the sister language meme was born. But that just meant a cease-fire, rather than peace, and the dissent and resentments continued to fester under the blanket of the sister language meme.

Until 2019, when the rename of Perl 6 to the Raku Programming Language happened. Factions within Perl 5 lost their common enemy, and fighting could start all over again. Which caused at least one pumpking to resign.

To mark Perl 6 as the cause for Perl 5's demise, is incorrect. Perl 6 was one of the effects of Perl 5's demise.

Meanwhile the Raku Programming Language continues to build a programming language of the future. You can check out the Rakudo Weekly News if you want to stay up-to-date on developments https://rakudoweekly.blog

Have you used Raku before? The new and improved regex syntax [1] IMHO completely obsoletes legacy PCRE. Writing regexes in other languages feels like stepping into an ICE vehicle after driving a Tesla: so crufty and old and obvious legacy.

Raku’s built-in grammars make parsers trivial to write. I effortlessly created two [2] — one for reordering fstab entries, and the other for converting human-readable LUKS offsets into cryptsetup sectors — on a lazy afternoon. Grammars in Raku make this second nature.

Then you have Raku’s multi-dispatch. It is more capable than Erlang/Elixir pattern matching:

    # a list with at least one element, extracting the head and tail
    multi sub tail(*@list ($head, *@tail)) { @tail }
    multi sub tail(*@list) { @list }

    [3]
    ==> tail()
    ==> say(); # []

    [3, 4]
    ==> tail()
    ==> say(); # [4]

    # pattern matching with arbitrary guards
    multi sub user($name where { is-valid-user($_) }) { $name.say }
    multi sub user($name) { "invalid name: $name".say }

    sub is-valid-user($name)
    {
        # notice the additive character class in this regex: “letters plus digits”
        # fail the match if $name is root
        try with $name ~~ /(<+:Letter +digit>+)/ { $0 ne 'root' or fail }; $!.not
    }

    user('name'); # name
    user('1234'); # 1234
    user('root'); # invalid name: root

    class Coordinates
    {
        has $.latitude is required;
        has $.longitude is required;
    }

    class City
    {
        has Str:D $.name is required;
        has Str:D $.state is required;
        has Str:D $.country is required;
        has Coordinates:D $.coordinates is required;
    }

    my $latitude = -37.840935;
    my $longitude = 144.946457;
    my Coordinates $coordinates .= new(:$latitude, :$longitude);
    my Str:D $name = 'Melbourne';
    my Str:D $state = 'Victoria';
    my Str:D $country = 'Australia';
    my City $melbourne .= new(:$name, :$state, :$country, :$coordinates);

    my City:D $sydney = do {
        my Coordinates:D $coordinates = do {
            my $latitude = -33.86514;
            my $longitude = 151.209900;
            Coordinates.new(:$latitude, :$longitude);
        };
        my Str:D $name = 'Sydney';
        my Str:D $state = 'New South Wales';
        my Str:D $country = 'Australia';
        City.new(:$name, :$state, :$country, :$coordinates);
    };

    # deeply nested argument deconstruction
    multi sub melbourne-or-bust(
        City:D $city (
            Str:D :$name where 'Melbourne',
            Str:D :$state,
            Str:D :$country,
            :$coordinates (
                :$latitude,
                :$longitude
            )
        )
    )
    {
        my $gist = qq:to/EOF/.trim;
        Welcome to the city of $name. It’s located in $state, $country.

        GPS coordinates: $latitude, $longitude
        EOF
        $gist.say;
    }

    multi sub melbourne-or-bust(City:D $city)
    {
        'This isn’t Melbourne.'.say;
    }

    melbourne-or-bust($melbourne); # Welcome to the city of Melbourne ...
    melbourne-or-bust($sydney); # This isn’t Melbourne
> Perl 6 was treated as the successor of Perl 5 -- and that was the mistake. It meant Perl 5 started dying,

Perl 6 took a long time to make, but how much did that matter? What was Perl going to do about Rails, Clojure, Go, Rust, JS/TS, and more? The world of programming languages used to be a lot smaller than it is today.

> Perl 6 had a new different syntax.

Inline::Perl5 [3] allows running legacy Perl 5 code in Perl 6 codebases.

[1]: https://docs.raku.org/language/5to6-nutshell#Regular_express...

[2]: https://github.com/atweiden/voidvault

[3]: https://github.com/niner/Inline-Perl5