Re: [RFC] [Discussion] Clone with
| From: | Michał Marcin Brzuchalski | Date: | Mon, 17 Apr 2023 08:05:32 +0000 |
| Subject: | Re: [RFC] [Discussion] Clone with | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120050@lists.php.net to get a copy of this message | ||
Hi Máté,
pon., 17 kwi 2023 o 08:32 Máté Kocsis <kocsismate90@gmail.com> napisał(a):
> Hi Everyone,
>
> Quite some time after mentioning the "clone with" construct the first time
> (at the end of the
>
> https://wiki.php.net/rfc/write_once_properties#run-time_behaviour
> section),
> finally I managed to create a working implementation for this feature which
> would make it possible to properly modify readonly properties
> while simplifying how we write "wither" methods:
> https://wiki.php.net/rfc/clone_with
Thanks for your efforts and for bringing that up.
I am curious if possible to implement the feature without using
with
keyword
it visually could look pretty close to something like an object initializer
in the future:
return clone $this {c: 1};
return new Bar {c: 1};
Cheers,
Michał Marcin Brzuchalski