Re: [RFC] Default expression
| From: | Bruce Weirdan | Date: | Mon, 26 Aug 2024 15:28:40 +0000 |
| Subject: | Re: [RFC] Default expression | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-125274@lists.php.net to get a copy of this message | ||
On Mon, Aug 26, 2024 at 12:47 PM Rowan Tommins [IMSoP] <imsop.php@rwec.co.uk>
wrote:
> Another approach that occurred to me was in the executor: rather than
> evaluating to the default value immediately, "default" could resolve to a
> special value, essentially wrapping the reflection parameter info. Then
> when the function is actually called, it would be "unboxed" and the actual
> value fetched, but use in any other context would be a type error.
>
I guess what the opponents to this RFC are zeroing on in this thread is the
conclusion that
default (as proposed) is a form of contravariant return,
and thus breaks Liskov Substitution Principle. Your suggestion of making it
an opaque value that cannot be read outside of the called function is a
nice (and maybe the only) way to resolve this problem.
--
Best regards,
Bruce Weirdan mailto:
weirdan@gmail.com