Re: [RFC] $this return type
| From: | Mike Schinkel | Date: | Thu, 09 Sep 2021 14:47:26 +0000 |
| Subject: | Re: [RFC] $this return type | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-116025@lists.php.net to get a copy of this message | ||
> On Sep 9, 2021, at 10:26 AM, Flávio Heleno <flaviohbatista@gmail.com> wrote:
>
> On Tue, Sep 7, 2021 at 10:27 AM Sebastian Bergmann <sebastian@php.net>
> wrote:
>
>> Am 07.09.2021 um 12:28 schrieb Nikita Popov:
>>> I have some reservations about this (which basically come down to $this
>> not
>>> being a proper "type", so should it be in the type system?) but I can see
>>> the practical usefulness, so I think it's worth discussing this.
>>
>> I am not conviced that there is enough value in this to introduce syntax
>> for it, but if at all, then please not "$this" as the name for a type.
>>
>> Off the top of my head, I think that "same" could make sense.
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: https://www.php.net/unsub.php
>>
>>
> Hi all,
>
> I'm sorry if I'm being naive, or simply put dumb, but the main difference
> that we're trying
> to achieve with having "$this" (or variations of it) as a valid return type
> as opposed to simply
> using "self" is to ensure that the underlying code is actually doing a
> "return $this" rather
> than returning any other valid "self" instance (such as "return new
> self();")?
So a *mutable* fluent style vs. an *immutable* fluent style?
-Mike