Re: [RFC] Partial Function Application, take 2
| From: | Dan Ackroyd | Date: | Thu, 10 Jun 2021 18:34:49 +0000 |
| Subject: | Re: [RFC] Partial Function Application, take 2 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-114822@lists.php.net to get a copy of this message | ||
On Thu, 10 Jun 2021 at 18:32, Guilliam Xavier <guilliam.xavier@gmail.com> wrote:
> Since
$null?->whatever(1, 'a') currently always
> returns null without error, shouldn't $null?->whatever(?,
> 'a') return a
> closure (with a signature built from the placeholders only) that will
> return null when called (i.e. equivalent to fn (mixed $arg1) =>
> null
> here)?
No.
The short circuiting should happen in the same place, no matter what
is to the right of the "?->".
Having the behaviour vary and sometimes not return null, would be
highly surprising.
cheers
Dan
Ack