Re: [CONCEPT][DISCUSSION] Instance as boolean
| From: | Josh Bruce | Date: | Sun, 12 Jul 2020 17:35:21 +0000 |
| Subject: | Re: [CONCEPT][DISCUSSION] Instance as boolean | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-110966@lists.php.net to get a copy of this message | ||
>
> Focusing on Bool is, I think, a good choice because it has an argument for it other than
> "well it works for strings." You hint at it in the writeup but really bury the lead: Null
> objects.
>
> Being able to not use null or false as a "not found" case and instead return an
> "empty" value object is very nice, but then you also want to know if the value returned is
> legitimate. An object that could self-cast to boolean makes something like this viable and
> type-safe:
>
>
Thanks!
I think you’re right - maybe just taking a minute to figure out what the lead was. lol
I updated the repo and link: https://bit.ly/php-0002 <https://bit.ly/php-0002>
Going to be starting a new thread with subject that matches better where we are:
Objects able to define emptiness (and possibly truthiness by extension to maintain consistency - but
object may be an exception??).
Cheers,
Josh
ps. Also did get registered to the wiki from a different thread conveniently happening at the same
time. :)