Re: [RFC] Type hints (parameter and return value)
| From: | Christian Schneider | Date: | Thu, 17 Apr 2008 11:48:50 +0000 |
| Subject: | Re: [RFC] Type hints (parameter and return value) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37056@lists.php.net to get a copy of this message | ||
Felipe Pena wrote:
> For parameter type hints, i have completed the actual implementation
> with the leftover php types:
> - string (binary string and unicode)
> - integer (accepting numeric string too)
> - double (accepting numeric string too)
> - boolean ('0', '1', true, false)
> - resource
> - object
I don't like the difference between
function (int) test($value) { ... }
and
function test(integer $value) { ... }
I don't think we should introduce two different names for something
which is basically the same. Even if there is (as I guess) a slight
difference (int *really* being int and integer allowing strings
containing numbers), which makes the WTF factor even higher IMHO.
Also about "New tokens (new keywords)": I haven't tried the patch so
excuse me asking. Does this mean $this->string is invalid because string
is a new keyword? Then I'd be strongly against having these new keywords.
Is there any performance impact for people not using type hints?
Just to make it clear: I think type hinting is a Bad Idea(tm) anyway but
*if* it is implemented I think you should consider the above points.
- Chris