Re: Re: PHP RFC: Nullsafe Calls
| From: | Mark Randall | Date: | Tue, 04 Jun 2019 21:17:03 +0000 |
| Subject: | Re: Re: PHP RFC: Nullsafe Calls | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105840@lists.php.net to get a copy of this message | ||
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()); AllenJBYou 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