develooper Front page | perl.perl5.porters | Postings from November 2010

Re: Semantics of safe-deref

Thread Previous | Thread Next
From:
Reverend Chip
Date:
November 29, 2010 13:36
Subject:
Re: Semantics of safe-deref
Message ID:
4CF41CC5.3070406@gmail.com
On 11/29/2010 1:32 PM, David Golden wrote:
> On Mon, Nov 29, 2010 at 4:26 PM, Jesse Vincent <jesse@fsck.com> wrote:
>> "If the dereference of the left hand side succeeds, then do the lookup
>> on the right hand side and continue on your way", which made "->?"
>> seem quite sensible to me. It was asking and answering a question about
>> the dereferencing operation.
>>
>> I believe that Zefram is of the opinion that what we're looking for is
>> "If the left hand side is defined, then try to dereference
>> it and explode or continue on your way as indicated." - Which certainly
>> makes pushing the conditional (?->) to the left make more sense.
> I understood it to be this:
>
>     $lhs OP $rhs ===  defined($lhs) ? $lhs->$rhs : undef
>
> I.e. just return "undef" (and don't explode) if the dereference would
> fail, otherwise, go ahead and do the dereference.

Sorry to <aol/> but .. yeah, this.


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