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

Re: disabling smartmatch and when()?

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
June 21, 2022 08:46
Subject:
Re: disabling smartmatch and when()?
Message ID:
20220621094533.58dd3497@shy.leonerd.org.uk
On Mon, 20 Jun 2022 18:10:37 -0400
Dan Book <grinnz@gmail.com> wrote:

> On Mon, Jun 20, 2022 at 5:56 PM SHIRAKATA Kentaro <argrath@ub32.org>
> wrote:
> 
> > How about declaring smartmatch as "discouraged" instead?
> >
> >  From https://perldoc.perl.org/perlpolicy#discouraged:
...

> 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
https://metacpan.org/pod/Syntax::Keyword::Match). 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
"experimental".

-- 
Paul "LeoNerd" Evans

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

Thread Previous | 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