Re: [RFC] Adding a "Stringable" interface to PHP 8
| From: | Nicolas Grekas | Date: | Tue, 11 Feb 2020 12:12:08 +0000 |
| Subject: | Re: [RFC] Adding a "Stringable" interface to PHP 8 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108468@lists.php.net to get a copy of this message | ||
>
> Just so someone has mentioned it... is "Stringable" really the best name
> for this interface? Reddit really didn't like it ;) Some possible
> alternatives: ToString, HasToString, CastsToString.
>
Naming things...
I'm not sure reddit is the way to lobby php-internals...
I proposed Stringable because it is the most consistent to me:
Traversable, Serializable, Countable, Throwable, JsonSerializable
all are related to some special engine behavior, which this ones also is.
I'm on the side of keeping Stringable.
> Something to keep in mind is that there has been a recent proposal for
> "Arrayable" as well, and that had very different semantics (not about
> __toArray() at all)
>
I didn't take part on this discussion, but I'm totally on Marco's side on
this one, I really hope this will NOT make it into the engine, for the
reasons he gives... :)
Nicolas