Re: RFC: Protocol Type Hinting

From: Date: Wed, 26 Jun 2013 09:51:13 +0000
Subject: Re: RFC: Protocol Type Hinting
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi,

On Wed, 26 Jun 2013 02:57:46 +0400, Stas Malyshev <[email protected]> wrote:

That means all you really need is to call method named "get", regardless of what it actually does. Usually the code doesn't work this way - you expect something to actually happen if you call get(), something specific. Interface ensures whoever wrote that object acknowledged that this is what he wants too.
But you (as a library dev) still have interfaces. You still use them. This discussion got really big in a short period of time, but we all know all this change does is gives us an ability to not write additional code. Some people already stated it - you just won't need to create adapters and it's cool. There's a lot of cases where you need to wire to different libraries and for that matter you create THIRD library and call it something like %lib1-name%%lib2-name%Adapter where you, in the best case, should create classes that inherit from some lib1's or lib2's classes (and just add "implements Lib2Interface"), or if there's some static methods - you are forced to create decorator which implements needed interfaces - and that is what will give a far more overhead than some runtime engine-level checks. What about static analysis, it just lays on YOUR shoulders, if you so want static analysis to work properly you just write code which implements interfaces. But if it's fine for you, then it's fine, it's easy. PS sorry for caps in some places

Thread (50 messages)

« previous php.internals (#67849) next »