Re: [VOTE] Optional Interfaces
Hi
Am 2025-03-20 17:09, schrieb Gina P. Banyard:
I don't see how this could (usefully) work in PHP, which doesn't scope the methods on a “per interface” basis / which makes methods just some syntactic sugar for a function that takes the object as a parameter. Once you have more than a handful of interfaces on a single object you are bound to have naming / signature conflicts, unless the interfaces use some oddly-specific name for their methods. Two different serialization libraries might want to use serialize()
for their methods, but using incompatible signatures (e.g. to pass additional options).
It works well for Rust, since each trait will need to be imported explicitly for the associated methods to be available. And then you can also call the method as a free-standing function, just passing the appropriate struct as a parameter to disambiguate them.
Best regards
Tim Düsterhus
Thread (12 messages)