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

Deprecation of smartmatch

Thread Next
Paul "LeoNerd" Evans
December 2, 2022 16:12
Deprecation of smartmatch
Message ID:
[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      |  |

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About