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

Re: Pre-RFC: Optional Chaining

From:
David Cantrell
Date:
January 5, 2022 14:22
Subject:
Re: Pre-RFC: Optional Chaining
Message ID:
20220105140756.GA28195@bytemark.barnyard.co.uk
Sorry for coming late to the game ...

On Fri, Oct 29, 2021 at 07:44:22PM +0800, Tom Molesworth via perl5-porters wrote:
> On Fri, 29 Oct 2021 at 18:35, Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
> > Likewise - given the positioning of the "?" there I would expect
> >   $obj?->method    # equivalent to  $obj->method if defined $obj;
> >   $obj->?method    # equivalent to  $obj->method if $obj->can("method")
> 
> Raising this suggestion for completeness (I like the suggested `?->` as-is):
> 
> `//->` would be more consistent with our existing `//` defined-or operator,
> since `? :` already sets the precedent that the `?` is checking for true,
> rather than defined.

See also my proposal a while back for a defined-match operator, in
<20190221115541.GB11111@bytemark.barnyard.co.uk>.

-- 
David Cantrell | Reality Engineer, Ministry of Information

More people are driven insane through religious hysteria than
by drinking alcohol.    -- W C Fields



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About