Parameter skipping
| From: | Craig Duncan | Date: | Sat, 06 Apr 2019 21:15:39 +0000 |
| Subject: | Parameter skipping | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-105123@lists.php.net to get a copy of this message | ||
Hi all,
After starting to use https://wiki.php.net/rfc/json_throw_on_error
in PHP
7.3 I've encountered the annoying issue of having to pass the $depth
parameter as 512 every time I want json_decode() to throw.
After doing this a few times I remembered the parameter skipping RFC that
Stas proposed a few years ago: https://wiki.php.net/rfc/skipparams
I've re-read the previous discussion and it seems to me there were two
common arguments against:
* Just design better APIs
* Named parameters would be better
Nobody has been able to crack named parameters (and it doesn't seem likely
anytime soon), and as we've seen from the JSON example above it's not
always as simple as having better APIs, so I wanted to see whether people
would be willing to support the *default* keyword for optional parameters
now.
Thanks,
Craig