Re: RFC: Protocol Type Hinting
| From: | Bernhard Schussek | Date: | Thu, 27 Jun 2013 12:29:38 +0000 |
| Subject: | Re: RFC: Protocol Type Hinting | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-67940@lists.php.net to get a copy of this message | ||
Hi Anthony,
I really like the idea. But I'd prefer the following syntax:
public function __construct(~HttpKernelInterfaceForClientIp $parent) {
$this->parent = $parent;
}
Reasons:
* A passed object does not have to explicitly implement the interface, but
only implicitly ("practically", "more or less"). The tilde conveys that
semantic very well.
* As you mentioned, brackets are (IMO too) close to generics.
Cheers,
Bernhard
--
Bernhard Schussek
Blog: http://webmozarts.com
Twitter: http://twitter.com/webmozart
2013/6/25 Anthony Ferrara <ircmaxell@gmail.com>
> 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
>