develooper Front page | perl.perl5.porters | Postings from December 2022

Deprecation of smartmatch

Thread Next
From:
Paul "LeoNerd" Evans
Date:
December 2, 2022 16:12
Subject:
Deprecation of smartmatch
Message ID:
20221202161235.601679a1@shy.leonerd.org.uk
[With my PSC hat on]

In Perl 5.10 we added `~~`, known as smartmatch, as a sort-of copy of
what is now in Raku (known as "Perl 6" at the time). Initially looked
at favourably, design problems were eventually found around it that
mean it is a poor match for the different type system that Perl 5 has.
This operator (and the related `given/when` syntax) sat in
"experimental" status ever since Perl 5.18, while we attempted to work
out what to do with it.

The time has now come to finally declare an end to this experiment. It
has not been possible to provide a meaningful, coherent set of
semantics for this operator that sits well with users. Because of this,
we feel it best to move the operator into "deprecated" status,
announcing that we *will* be removing it in a later version of perl.
This is currently scheduled for two releases later (Perl 5.42 in the
current schedule).

By the time that Perl 5.38 is released, we aim to have some updated
documentation that explains the deprecated feature and the reasons
behind it, and also gives advice to users who are already using this
syntax on what they can write instead to replace it.

We also aim to provide some thoughts on what new features may be added
to Perl in the future to provide a better solution to these common
situations that smartmatch and `given/when` are currently used for.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About