Re: __repr() magic method (was Re: Proposal: short_var_export($value, bool $return=false, int $flags=0))
| From: | Marco Pivetta | Date: | Wed, 20 Jan 2021 16:28:49 +0000 |
| Subject: | Re: __repr() magic method (was Re: Proposal: short_var_export($value, bool $return=false, int $flags=0)) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112941@lists.php.net to get a copy of this message | ||
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
>
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 ´.3Ș
> õp7jPB`Ö1Representable interface,
> like Stringable?
> https://wiki.php.net/rfc/stringable
>
Ooof, can we just avoid more magic methods overall? :|
Marco Pivetta
http://twitter.com/Ocramius
http://ocramius.github.com/