Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-19 Thread Rowan Collins
Larry Garfield wrote on 19/04/2016 16:21: Which is why I'm not sure I like that approach, because the place I then call $handler needs to have a conditional in it. There's another RFC that was posted to Twitter but hasn't made it to the list yet that seems to solve this better:

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-19 Thread Marcio Almada
Hi! 2016-04-19 11:21 GMT-04:00 Larry Garfield : > On 4/19/16 10:02 AM, Rowan Collins wrote: > >> Dmitry Stogov wrote on 19/04/2016 15:48: >> >>> callable-type is much simpler solution for this use-case. >>> Usage of Interfaces to check function prototypes is a bit tricky,

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-19 Thread Larry Garfield
On 4/19/16 10:02 AM, Rowan Collins wrote: Dmitry Stogov wrote on 19/04/2016 15:48: callable-type is much simpler solution for this use-case. Usage of Interfaces to check function prototypes is a bit tricky, but yes, this is a possible use-case. Do you like to work with framework, that use this

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-19 Thread Rowan Collins
Dmitry Stogov wrote on 19/04/2016 15:48: callable-type is much simpler solution for this use-case. Usage of Interfaces to check function prototypes is a bit tricky, but yes, this is a possible use-case. Do you like to work with framework, that use this trick for every callback? If you don't

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-19 Thread Dmitry Stogov
On 04/19/2016 05:30 PM, Rowan Collins wrote: Dmitry Stogov wrote on 19/04/2016 15:12: I prefer intuitive concepts, that I may use without rereading manual again and again. For this one, I even can't imagine a natural (not over-designed) use case. The use case that came to my mind is kind

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-19 Thread Rowan Collins
Dmitry Stogov wrote on 19/04/2016 15:12: I prefer intuitive concepts, that I may use without rereading manual again and again. For this one, I even can't imagine a natural (not over-designed) use case. The use case that came to my mind is kind of the other way around from "syntax sugar for

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-19 Thread Dmitry Stogov
For me, the proposal is too complex. I prefer intuitive concepts, that I may use without rereading manual again and again. For this one, I even can't imagine a natural (not over-designed) use case. But this is my personal opinion, and I may be wrong :) I'll review the code later. Thanks.

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-19 Thread Dmitry Stogov
On 04/19/2016 03:52 PM, Joe Watkins wrote: Oh, it's confusing text in the RFC, using the word "Interface" ... that's meant as a placeholder for InterfaceName. Cheers Joe On Tue, Apr 19, 2016 at 1:50 PM, Joe Watkins > wrote: Morning

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-19 Thread Joe Watkins
> What value? Yes, shorter, more concise (from the programmers perspective) syntax. Right now, if you do a lot of work with Closures, you have to verify their interface, the value in having the engine do it for you seems really obvious. But also ... > I thought the same might be implemented

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-19 Thread Joe Watkins
Oh, it's confusing text in the RFC, using the word "Interface" ... that's meant as a placeholder for InterfaceName. Cheers Joe On Tue, Apr 19, 2016 at 1:50 PM, Joe Watkins wrote: > Morning Dmitry, > > In your example, they will do the same thing. > > Anon classes

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-19 Thread Joe Watkins
Morning Dmitry, In your example, they will do the same thing. Anon classes don't have lexical scope, I have a patch for that, and an RFC, I'm just tidying it. Even when anon classes do have lexical scope, there is value in being able to implement these kinds of interfaces using only a

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-19 Thread Dmitry Stogov
Are $cb1 and $cb2 going to be the same (do the same)? Is this just a new syntax sugar, or a really new feature? According to implementation, I think, you shouldn't extend "zend_closure" with "interface". If this is a sugar, lets implement it as a sugar (without VM changes). But may be I

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-18 Thread Sara Golemon
On Mon, Apr 18, 2016 at 12:17 PM, Stanislav Malyshev wrote: > Hi! > >> Please review the following RFC: >> https://wiki.php.net/rfc/functional-interfaces >> An implementation is provided, and is testable on 3v4l. > > This looks like a rather narrow case already

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-18 Thread Marcio Almada
Hi! 2016-04-18 15:17 GMT-04:00 Stanislav Malyshev : > Hi! > > > Please review the following RFC: > > > > https://wiki.php.net/rfc/functional-interfaces > > > > An implementation is provided, and is testable on 3v4l. > > This looks like a rather narrow case

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-18 Thread Stanislav Malyshev
Hi! > Please review the following RFC: > > https://wiki.php.net/rfc/functional-interfaces > > An implementation is provided, and is testable on 3v4l. This looks like a rather narrow case already covered by anonymous classes. Am I missing something? What is the added value of it

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-18 Thread Fleshgrinder
+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

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-18 Thread Rowan Collins
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

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-18 Thread Joe Watkins
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

Re: [PHP-DEV] RFC: Functional Interfaces

2016-04-18 Thread Rowan Collins
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,