Re: [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters
| From: | Simon Schick | Date: | Fri, 09 Mar 2012 17:45:19 +0000 |
| Subject: | Re: [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-58825@lists.php.net to get a copy of this message | ||
2012/3/9 Lazare Inepologlou <linepogl@gmail.com>
>
> Type casting combined with passing by reference is problematic in many ways. Just an example:
>
> fuction foo( string & $buffer) { ... }
> foo( $my_buffer );
>
> Here, $my_buffer has just been declared, so it is null. Should this be an error? I don't
> know! So, I think that that passing by reference should not be (immediately) supported.
>
Hi, Lazare
This should at least throw an E_NOTICE :) And also an error as NULL is
not allowed here.
Let me modify your example:
fuction foo( string & $buffer = NULL) { ... }
foo( $my_buffer );
This would only raise the E_NOTICE because the variable has not been declared.
Or would you say that NULL is equal with an empty string (talking
about implicit casting)? I would not like that, but if, don't let it
be (int)0 or (bool)false as well.
Bye
Simon