Re: [RFC][Discussion] Objects can be declared falsifiable
| From: | Matthew Brown | Date: | Wed, 15 Jul 2020 04:48:05 +0000 |
| Subject: | Re: [RFC][Discussion] Objects can be declared falsifiable | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111010@lists.php.net to get a copy of this message | ||
On Tue, 14 Jul 2020 at 19:59, Josh Bruce <josh@joshbruce.dev> wrote:
> Implement an interface and magic method to allow objects to represent
> false (or empty) while still be valid instances of the custom object (type).
>
> https://wiki.php.net/rfc/objects-can-be-falsifiable <
> https://wiki.php.net/rfc/objects-can-be-falsifiable>
>
> If you saw the latest from this morning, not much has changed except
> hopefully improved formatting and now being the official mix of things.
>
> If this is your first time, the cues are taken from:
>
> - __toString()
> - Stringable
> - and __toArray() (not accepted or approved yet)
>
> Thank you for all the feedback and patience so far, appreciate it!
>
> Cheers,
> Josh
I'm not sure I love this (mostly from a static analysis standpoint).
It means that there would exist some
$foo with the property that `$foo &&
!$foo` evaluates to true.
That seems to be a bad place for a language to go, and it would increase
the false-negative rate of static analysis tools.