On Sep 30, 2026, at 9:29 PM, Karoly Negyesi <[email protected]> wrote:
> 
> Hello,
> 
> I submitted a draft RFC to https://github.com/php/php-src/pull/24030. The PR 
> contains an implementation and tests (please be gentle, I haven't written C 
> in decades).
> 
> I propose an "implements by" syntax to automate delegation, closely modelled 
> on Kotlin.
> 
> In short, 
> 
> interface T { function foo(); }
> class A implements T { function foo() { print "A"; } }
> class C implements T by $t { function __construct(private T $t) {} }
> new C(new A)->foo();
> 
> The performance impact should be minimal as everything happens at compile 
> time and during class linking with no runtime changes. There is no BC break. 
> (That's the intention, at least. I modelled the change after enum.)
> 
> Regards
> 
> Karoly Negyesi
> 
> P.S. Credit to Larry Garfield for pushing for this better syntax than my 
> original idea.
> 

The RFC itself needs to be posted to wiki.php.net (and link to your
implementation PR). See below link for the process there and how to
get access to edit:

https://wiki.php.net/rfc/howto

Reply via email to