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

Re: disabling smartmatch and when()?

Thread Previous | Thread Next
Paul "LeoNerd" Evans
June 21, 2022 08:46
Re: disabling smartmatch and when()?
Message ID:
On Mon, 20 Jun 2022 18:10:37 -0400
Dan Book <> wrote:

> On Mon, Jun 20, 2022 at 5:56 PM SHIRAKATA Kentaro <>
> wrote:
> > How about declaring smartmatch as "discouraged" instead?
> >
> >  From

> In practice it is treated this way already. But we might as well fully
> deprecate it. It needs to be replaced with features that are better
> designed, while not silently changing behavior of existing programs by
> trying to fix the existing operator.

I think there's two things we need to do:

 1) Make ~~ and given/when much louder about their "you shouldn't use
    this for new code" status;

 2) Create a better replacement

For part 2 I've been working on things like match/case syntax (see It works for simple
cases but there's still a lot of design work left to do. It would also
be nice to continue work on my various "Syntax::Operator::..." modules
and come up with a way to do `in` tests as well.

There's often been an assumption that part 2 has to be done before we
do part 1, but I feel we can do them both.

Perhaps indeed, now that the `switch` feature has been removed from the
:5.36 feature bundle, it is time to adjust the wording of the
documentation and warning, to say "discouraged" instead of merely

Paul "LeoNerd" Evans      |  |

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