Type safety, IDE type hinting.

A callable can be anything, an interface guarantees parameter types and, in 
PHP 7, return types.

Interfaces also indicate explicit implementation of the standard - rather 
than implicit implementation on the basis that the passed parameter could 
be executed.

All other reasons I've forgotten as to why interface type hints are a good 
thing.

On Friday, July 29, 2016 at 10:14:46 AM UTC+1, Matthieu Napoli wrote:
>
> Thanks. However I'm still looking for a good reason why we have this 
> interface: why not simply `callable $next` ?
>
> - FrameInterface doesn't represent any actual usage or existing 
> middlewares today
> - FrameInterface is more complex than `callable`
>
> Matthieu
>
> Le mardi 12 juillet 2016 16:39:53 UTC+2, Beau Simensen a écrit :
>>
>> On Tuesday, July 12, 2016 at 3:26:42 PM UTC+1, Rob Allen wrote:
>>>
>>> Where did the word "Frame" come from and in what context is it used. It 
>>> means nothing to me and I don't think I'm alone in having no clue how I 
>>> would be able to infer that $frame might have a next() method. It's very 
>>> weird and I think it's a negative when looking at the function signature as 
>>> it's a meaningless word unless you know some back story that I clearly 
>>> don't?
>>>
>>> I would love an explanation as it looks to me like an area of confusion 
>>> for people new to writing middleware.
>>>
>>
>> I believe it has something to do with the concept of call stacks / stack 
>> frames? Reading a bit real fast on that I'm not 100% sure it fits entirely 
>> but I think that was the intention.
>>
>>
>> http://stackoverflow.com/questions/10057443/explain-the-concept-of-a-stack-frame-in-a-nutshell
>>
>> "A call stack is composed of 1 or many several stack frames. Each stack 
>> frame corresponds to a call to a function or procedure which has not yet 
>> terminated with a return." 
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to php-fig+unsubscr...@googlegroups.com.
To post to this group, send email to php-fig@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/97de212d-f425-4679-9a4d-8c79fddbd45a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to