Re: Pre proposal for "Class extension functions"
| From: | Christoph M. Becker | Date: | Tue, 25 Sep 2018 14:48:19 +0000 |
| Subject: | Re: Pre proposal for "Class extension functions" | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-103258@lists.php.net to get a copy of this message | ||
On 25.09.2018 at 08:50, Stanislav Malyshev wrote:
>> I want to do RFS proposal for new language concept - Class extension
>> functions.
>>
>> Syntax will looks like:
>>
>> function DateTime->localTime() {
>> return $this->format('H:i');
>> }
>
> I think this wouldn't add much what we already can do, […]
Actually, we can do this for a long time (by using runkit_method_add[1]
or uopz_add_function[2]); it would just add a syntactic sugar for it.
> […] but will invite
> style of programming that is best avoided.
ACK.
[1] <http://php.net/manual/en/function.runkit-method-add.php>
[2] <http://php.net/manual/en/function.uopz-add-function.php>
--
Christoph M. Becker