Re: RFC: Protocol Type Hinting

From: Date: Tue, 25 Jun 2013 16:24:01 +0000
Subject: Re: RFC: Protocol Type Hinting
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-67812@lists.php.net to get a copy of this message
Nikita, Thanks for the response! By looking at the diff I see it will only work for type-hints in > functions/methods. Could we also see something like "$var instanceof > <ProtoInterface>"? I fear it can't be done this way because of parser > limitations, but I believe this feature would be as useful as type-hinting > in functions. > Well, we could add a new construct "$var protocolof Proto" or "$var actsasa Proto" or something. I wouldn't conflate instanceof with this behavior for two reason: instanceof implies type checking. This is not type checking. Second, instanceof can be used with a variable ont he right side. SO this could get awkward... As to the name of the construct, I am at a loss... But I'm sure we can come up with something interesting... Anthony

« previous php.internals (#67812) next »