Re: Inline typecasting / typehinting for classes and interfaces

From: Date: Wed, 15 Aug 2012 08:29:12 +0000
Subject: Re: Inline typecasting / typehinting for classes and interfaces
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-62170@lists.php.net to get a copy of this message
And assignment is a kinda common operation. So I hope you can see what's wrong with it now.
No I do not. Not every imaginable use case should have dedicated language construct for it - sometimes it is OK to type 2 lines of code. Sometimes even 3. This case is well served by existing language syntax, which also allows much more flexibility and control over what happens if the variable does not match. I see no reason to invent language construct the only purpose of which is to save you typing one if clause.
Let me ask you - do you think the existing PHP typehints are pointless too? Do you feel they don't give you enough flexibility? Do you feel they reinvented a language construct for the purpose of saving the typing of one if clause (per argument) (per method) (per class)? And why do you keep ignoring the fact that IDE's need additional clutches to understand the type of the variable? Stan

« previous php.internals (#62170) next »