Re: [CONCEPT][DISCUSSION] Allow objects to declare e mptiness and by extension truthiness
| From: | Larry Garfield | Date: | Sun, 12 Jul 2020 23:46:54 +0000 |
| Subject: | Re: [CONCEPT][DISCUSSION] Allow objects to declare e mptiness and by extension truthiness | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-110969@lists.php.net to get a copy of this message | ||
On Sun, Jul 12, 2020, at 12:48 PM, Josh Bruce wrote:
> Latest version as we zero in on what this is really about:
> https://bit.ly/php-0002
> <https://bit.ly/php-0002>
>
> Other threads:
>
> 1. https://externals.io/message/110879
> <https://externals.io/message/110879>
> 2. https://externals.io/message/110881 <=ABµ÷
> þŸÚãôŒhttps://externals.io/message/110881>
>
> Thanks for all the feedback so far! Definitely feels like progress.
>
> Cheers,
> Josh
Hi Josh. This is a big improvement, and I think focuses on the useful value-add a lot better.
Basing it off of Countable rather than Stringable is, I think, a safer overall approach, especially
as it then gets us toBool as effectively a side-effect.
There's 2 additional improvements I'd suggest:
1) The 2 places that you have lists of "this thing produces true/false" could likely stand
to be turned into tables to make it clearer, especially when demonstrating that isEmpty() and
__toBool() are effectively opposites of each other so we get a 2-for-1 deal.
2) Include some less-random examples of real "empty" objects.
Also, please be warned that the PHP wiki doesn't use Markdown. It uses some wonky proprietary
ancient mess instead. Now that you have Wiki access you should probably start using the PHP Wiki
instead of Github so that you don't have to convert a mess of nice formatting from Markdown to
PHPWiki-down.
I like this idea and wish I had the skillz to help implement it. :-)
--Larry Garfield