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

Semantics of safe-deref

Thread Next
Jesse Vincent
November 29, 2010 13:27
Semantics of safe-deref
Message ID:
[This thread is NOT about the syntax of our new friend. I'm using two
bits of syntax to try to explain the language design question. Argue
about them with me in the other thread, please.]

Zefram and I have been chatting on IRC about the semantics of the
safe-dereferencing arrow, which, I think, has led to a lot of our
disagreement about what makes the most sense as a name for it.

I'd (somewhat naively) assumed that the ideal implementation of 
the new feature was:

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

In most cases, these two things are the same, but when you start getting
into the vagaries of overloads and other fun, they become quite

I suspect that ->? is going to be more interestingly useful, but that ?-> 
is probably a bit easier to define. Which one do we want?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About