Joe Watkins wrote on 18/04/2016 12:53:
Morning,

> 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?

The terminology is borrowed, Java 8 uses lamdas to implement specially annotated interfaces, it refers to them as functional interfaces.


Thanks, I figured that was probably the case.


As far as anyone who is not familiar with the workings of PHP is concerned, what they have is a function that implements an interface, functional interface is a pretty good description of that.

I guess what's confusing is that the new feature happens entirely at the implementation end, but the term describes the interface itself. What we actually have is a functional *implementation* of a normal, non-annotated interface; but the interface is *implicitly* functional because of having only a single method. So when the error says you have a "non functional interface", it's not clear what you need to do about it.

I like the implicit definition, though, because it reduces the need for a forwards compatibility break (libraries can support old versions of PHP, but their users still take advantage of the new feature if they want). So I'm not really sure how to make the definition of "functional interface" clearer, other than making sure we write some decent documentation. :)

Regards,
--
Rowan Collins
[IMSoP]

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

Reply via email to