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

Re: disabling smartmatch and when()?

Thread Previous | Thread Next
From:
Alexander Hartmaier
Date:
June 21, 2022 09:38
Subject:
Re: disabling smartmatch and when()?
Message ID:
CAB49Qrbu=2J8t5=VRASJzfgXK=8h9JGSK5JHkJSX5B7nu-ciqQ@mail.gmail.com
On Tue, Jun 21, 2022 at 10:46 AM Paul "LeoNerd" Evans <
leonerd@leonerd.org.uk> wrote:

> 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".
>

I'd prefer a clear vocabulary/glossary like DBIx::Class (
https://metacpan.org/dist/DBIx-Class/view/lib/DBIx/Class/Manual/Glossary.pod)
has it, that lists the words used and their meaning.
'discouraged' isn't strong enough for me. If you plan to remove or change
the current behavior, and it isn't clear if *all* currently supported
variants will continue to work, I'd name it 'deprecated' aka 'get rid of it
before a stable Perl version is released that breaks your code.

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