Joe Watkins wrote on 18/04/2016 11:22:
Please review the following RFC:
https://wiki.php.net/rfc/functional-interfaces
An implementation is provided, and is testable on 3v4l.
This sounds like a really nice feature. As well as using functions to
implement existing interfaces, it gives a nice way of typehinting the
requirements of a callback without forcing users to create an object.
I must admit to being a bit confused by the term "functional interface"
at first, though, because "functional" has so many different meanings -
is this a term used elsewhere, or is it up for debate?
In particular, the error message "Fatal error: cannot implement non
functional interface IFoo" makes me wonder what's "non-functional" about
the interface. It would be clearer to me if it was more specific and
avoided the jargon, e.g. "Anonymous function cannot implement interface
with more than one method".
The error "functional interface cannot implement self" also seems
inconsistent with the others - here "functional interface" refers to the
*implementation*, not the interface. It might be clearer to just say
"cannot implement non interface self" anyway - there's nothing actually
special about "self" here, it's just another example of trying to use a
class as an interface, which is illegal whatever the implementation.
These are of course minor details, and the rest of the feature as
described sounds great. :)
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php