Re: Pre-RFC proposal: opt-in implicit interfaces / structural typing
| From: | Rowan Tommins [IMSoP] | Date: | Fri, 07 Nov 2025 19:19:37 +0000 |
| Subject: | Re: Pre-RFC proposal: opt-in implicit interfaces / structural typing | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129137@lists.php.net to get a copy of this message | ||
On 07/11/2025 17:05, Spencer Malone wrote:
Hey all! Long time browser, first time emailer. I wanted to start a pre-RFC discussion on the proposal of opt-in implicit interfaces / structural typing / "golang style interfaces".Hi and welcome :) In general, I prefer explicit code over implicit, so wouldn't be an enthusiastic supporter of this (although I might abstain rather than voting against). However, I though it worth mentioning that PHP has one implicit interface already: any class with an __toString() method magically implements Stringable. I've never really understood why, or why that interface even exists; but at least having a general concept of "implicit interface" would make it less magical. -- Rowan Tommins [IMSoP]