Re: Pre proposal for "Class extension functions"

From: Date: Mon, 24 Sep 2018 14:34:02 +0000
Subject: Re: Pre proposal for "Class extension functions"
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-103249@lists.php.net to get a copy of this message
On Mon, Sep 24, 2018 at 5:21 AM Andrey O Gromov <AGromov@alfabank.ru> wrote: > > Hello. > > 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'); > } > > $date = new DateTime(); > > echo $date->localTime(); > > > Realisation draft already written ( > > https://github.com/rjhdby/php-src/commit/a54d7d3f8504d2e15908bb0e44de0b2f87683872 > ) > > It is interesting or not? Definitely interesting. The patch doesn't seem to handle inheritance conflicts, though. For instance, if I add something to a base class that ends up conflicting with a sub-class that is already defined. It may not need to handle it in any particular way, but should be specified at least.

« previous php.internals (#103249) next »