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

Re: Deprecation of smartmatch

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
December 4, 2022 22:54
Subject:
Re: Deprecation of smartmatch
Message ID:
20221204225401.40c47984@shy.leonerd.org.uk
On Sun, 4 Dec 2022 15:08:45 +0100
Martijn Lievaart <m@rtij.nl> wrote:

> A thought occured to me of a possible problem here. Consider:
> 
>      $its_in = $needle in:=~ qr/haystack/;
> 
> v.s.
> 
>      $its_in = $needle in:< @haystack;
> 
> Wouldn't the first to be the RHS of the op, and the second the LHS? 
> Wouldn't this create a problem? Or do I simply misunderstand?

I'm not sure I see the problem.

Actually for several reasons. Firstly, `in` doesn't permit arbitrary
operators. Only `eq`, `==`, or anything custom registered with
XS::Parse::Infix that says it is an equality operator (thus permitting
`equ` and `===`). It would not permit `<` or even `=~`.

Secondly I don't at all follow what you mean about "be the RHS of the
op" here. Can you explain it some more?

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