Re: [RFC] Static return type
| From: | Rowan Tommins | Date: | Wed, 08 Jan 2020 11:57:31 +0000 |
| Subject: | Re: [RFC] Static return type | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108030@lists.php.net to get a copy of this message | ||
On Wed, 8 Jan 2020 at 11:42, Nikita Popov <nikita.ppv@gmail.com> wrote:
> I would like to propose the following RFC, which allows using "static" as a
> return type:
>
> https://wiki.php.net/rfc/static_return_type
>
> While I'm personally not a fan of late static binding, we do support it and
> people do use it quite heavily, so I think we should also support it in
> return types.
>
A big +1 from me; I'd probably have assumed it would work and be
disappointed when it didn't.
I can see why late static binding isn't to everyone's taste as a concept,
but it is very useful to emulate other features like named constructors, as
you show in the RFC.
The fluent interface example is interesting, because it doesn't actually
involve late static binding at all, we just need some way to say "what
comes out is the same type as what goes in".
Regards,
--
Rowan Tommins
[IMSoP]