Re: RE: Optional scalar type hinting
| From: | Markus Fischer | Date: | Fri, 04 Jan 2008 01:15:52 +0000 |
| Subject: | Re: RE: Optional scalar type hinting | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-34386@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Stanislav Malyshev wrote:
>> You aren't making it a strict static typed language. All that you are
>> doing
>> is saying that at certain points (function entry) that the values are
>> checked
>> and converted to certain types. If within the fuction an argument
>> hinted as
>> integer is used in a string context, the juggling will still happen.
>
> So it's basically another way to say (string)? Again, that's not what
> was said by other people discussing it. But all that just to save one
> (string) inside function?
I agree with Stanislav here.
For me "type hinting" has nothing to do with "type conversion". Hinting
a 'string' expects a string, nothing else, not even an object.
If you need this, you need to call the function/method with an explicit
conversion. It's a less 'wtf' factor going on.
- - Markus
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHfYjI1nS0RcInK9ARAvEwAKC0WhOjaogX+f84rQArW5s071fSDgCgriWl
1+JM1RK46VVFL7Bz8pjjID0=
=ORed
-----END PGP SIGNATURE-----