Re: [RFC] Adding a "Stringable" interface to PHP 8
| From: | Guilliam Xavier | Date: | Tue, 11 Feb 2020 13:13:27 +0000 |
| Subject: | Re: [RFC] Adding a "Stringable" interface to PHP 8 | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108478@lists.php.net to get a copy of this message | ||
On Tue, Feb 11, 2020 at 2:11 PM Michał Brzuchalski
<michal.brzuchalski@gmail.com> wrote:
>
> wt., 11 lut 2020 o 13:59 Guilliam Xavier <guilliam.xavier@gmail.com> napisał(a):
>>
>> On Tue, Feb 11, 2020 at 1:12 PM Nicolas Grekas
>> <nicolas.grekas+php@gmail.com> wrote:
>> >
>> > >
>> > > 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.
>>
>> But one could argue that "string" is not a verb like "traverse",
>> "serialize", "count", "throw" etc.
>> Potential alternatives would be Stringifyable (or Stringifiable?),
>> StringCastable, StringConvertible...
>> (Even though I personally have no problem with "Stringable")
>>
>
> Maybe StringObject? We do already have ArrayObject.
But ArrayObject is not a interface (ArrayAccess is).
--
Guilliam Xavier