Re: RFC: Functional Interfaces

From: Date: Mon, 18 Apr 2016 18:28:58 +0000
Subject: Re: RFC: Functional Interfaces
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-92420@lists.php.net to get a copy of this message
+1 for the feature, very nice syntactic sugar to solve some edge cases. I agree with Rowan, i also do not like the name and propose to call them *closure interfaces*. There are already various synonyms for closures: - anonymous function - lambda function - callback* However, the strongest argument to call them *closure* is the fact that the the class in PHP itself is actually called *\Closure*. I would even go as far as saying that the documentation should be updated to always use that word everywhere.* The fact that only closures can implement such interfaces strengthens the reason to call them as proposed in my opinion. Just because Java calls them /functional/ does not mean that we should. Regarding error messages: Fatal error: cannot implement non functional interface IFoo in /in/65W6i on line 7 Fatal error: cannot implement nonclosure interface IFoo in /in/65W6i on line 7 Note on grammar: http://www.chicagomanualofstyle.org/qanda/data/faq/topics/HyphensEnDashesEmDashes/faq0079.html *) There is of course the situation of the various other ways to declare the so called *user functions* (/call_user_func()/ and /call_user_func_array()/) and those should always be referred to as *callback*; imho. -- Richard "Fleshgrinder" Fussenegger

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.internals (#92420) next »