On Tue, Apr 25, 2023, at 6:20 PM, Michał Marcin Brzuchalski wrote:

> Personally I don't like this way of shaping callable types. Given examples
> are really confusing me. Call of a castTo() with argument representing an
> interface with a method is confusing as the method magically appears on a
> closure without explicit binding to it! What if an interface has more than
> one method? What if I wanna choose which one?

Multi-method interfaces would be explicitly disallowed and trigger an Error.  
If providing only a single "method", then there's no logical way for it to 
satisfy a multi-method interface.  But there are ample single-method interfaces 
around PHPlandia.  And a single-method interface has no ambiguity about which 
method the closure corresponds to.

--Larry Garfield

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to