develooper Front page | perl.perl5.porters | Postings from February 2019

Re: New defined-match operator

Thread Previous | Thread Next
From:
Aristotle Pagaltzis
Date:
February 22, 2019 06:39
Subject:
Re: New defined-match operator
Message ID:
20190222063343.GA17414@plasmasturm.org
* Richard Leach <rich+perl@hyphen-dash-hyphen.info> [2019-02-22 02:44]:
> On Thu, Feb 21, 2019 at 6:50 PM Aristotle Pagaltzis <pagaltzis@gmx.de> wrote:
> > * David Cantrell <david@cantrell.org.uk> [2019-02-21 13:25]:
> > > We all know how convenient it is to write this:
> > > Well, wouldn't it be nice to be able to write this:
> > >
> > >   if($foo //~ /bar/)
>
> if($foo &&~ /bar/) seems cognitively easier.

Dunno that it’s easier, but the proposal was for it to be testing
definedness, not truthiness, so I do know it’s more misleading.

Also I’m sure &&~ already occurs in actual code since not only does
it have some meaning, like //~ does, it’s even a very plausible one.

> Horrible line noise follows:

I agree. :-)

> (if you assumed the && applied to all previous calls, then
> $foo->bar->baz->&&->quux)

And if you want it applied to all *following* calls instead…?

And if only the middle call in the chain should be optional…?

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

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