Re: RFC: Protocol Type Hinting

From: Date: Tue, 25 Jun 2013 18:47:59 +0000
Subject: Re: RFC: Protocol Type Hinting
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Anthony,

I like it.  The one thing that is lacking in the PHP ecosystem is some kind of support for a "Gentleman's Agreement" when it comes to APIs.  I am very much opposed to central bodies of code and/or shared interfaces (like the PSR-3's et. al.) for seemingly simple and cross-cutting APIs.

An idea I had been kicking around, if yours in full does not pass the muster, was adding a function to do something similar (also requires changes to the instanceof checks in the engine):

  register_compatible_types($yourType, $myType);

which basically would allow any of $myTypes (My\LoggerInterface) to pass when the engine is testing for instanceof $yourType.

I do hope we get something like either of these solutions for PHP.next.

-ralph

On 6/25/13 10:57 AM, Anthony Ferrara wrote:
Hey all, I want to throw out this draft RFC to get the concept floating around and get feedback early. https://wiki.php.net/rfc/protocol_type_hinting There are still open questions, and a more complete (and cleaner) implementation will be needed before officially proposing it, but I wanted to get the concept out as soon as possible. What do you think? Thanks! Anthony


Thread (50 messages)

« previous php.internals (#67818) next »