Re: [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters

From: Date: Sat, 10 Mar 2012 07:45:32 +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 [email protected] to get a copy of this message

On 9 Mar, 2012, at 11:20 PM, Lazare Inepologlou <[email protected]> wrote:

> 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.
> 

Strictly speaking, if you add a type to a referenced variable in that way it's only logical
that you expect it to have a proper value when the function is called. After all, it's not an
output type declaration :)



Thread (46 messages)

« previous php.internals (#58831) next »