Re: [PHP-DEV] Re: PHP RFC: Nullsafe Calls

This is only part of a thread. view whole thread
June 4, 2019 21:17 (Mark Randall)
On 04/06/2019 20:05, AllenJB wrote:
> Common use cases I can think of would be parameters in a method call, > which with null safe calls would be: >   $m->n($x?->y()?->z()); > AllenJB
You bring up many good points about the (extremely hastily) composed syntax suggestion for short catch blocks, and their resolution is probably best left for a different discussion. It is an attempt to work around the somewhat built-in flaw in using nulls for such operations, mainly that null itself can often be a perfectly legitimate return value from the last link of the chain, and I believe being able to tell the difference would have at least some useful applications. Clearly there's ways around that using the current, more verbose method, but it would be nice if a way could be found so that this potential ambiguity wasn't there in the first place if this new mechanism is added. Mark Randall