Re: __repr() magic method (was Re: Proposal: short_var_export($value, bool $return=false, int $flags=0))
| From: | Ben Ramsey | Date: | Wed, 20 Jan 2021 16:30:50 +0000 |
| Subject: | Re: __repr() magic method (was Re: Proposal: short_var_export($value, bool $return=false, int $flags=0)) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112942@lists.php.net to get a copy of this message | ||
> On Jan 20, 2021, at 10:28, Marco Pivetta <ocramius@gmail.com> wrote:
>
> On Wed, Jan 20, 2021 at 5:27 PM Ben Ramsey <ben@benramsey.com> wrote:
>> Taking this to a new thread so I don’t derail the
>>
Attachment: [application/pgp-signature] Message signed with OpenPGP signature.asc
short_var_export() thread.
>>
>> Dik, I like this addition, but I think the name “repr” might be confusing to PHP
>> developers who aren’t familiar with Python idioms. PHP function names and coding standards within
>> the community tend to lean more toward verbosity than terseness, when it comes to naming things.
>>
>> Perhaps we should follow the lead of __toString() and use
>> __toRepresentation()? Maybe also introduce a
>> Representable interface, like
>> Stringable?
>> https://wiki.php.net/rfc/stringable
>
> Ooof, can we just avoid more magic methods overall? :|
I think that ship has sailed, friend. ;-)
Cheers,
Ben
Attachment: [application/pgp-signature] Message signed with OpenPGP signature.asc