Re: Scalar Type Hinting

From: Date: Wed, 07 Mar 2012 07:31:07 +0000
Subject: Re: Scalar Type Hinting
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi!


Just took a look on it - the syntax proposed there is quite ugly and rather confusing, I really wouldn't like to have such syntax in PHP.
Also "(int) $foo = “1” will generate an E_COMPILE_ERROR" makes no sense to me.
Also, this line:
function test((int) $intParam, (string) $strParam = "foo", (array) $array) {}

is not proper PHP code - it contains optional parameter and then parameter with no default.

And can we please stop using word "hinting"?
We can call it type conversion, typecasting, type coercion, etc.
http://en.wikipedia.org/wiki/Type_conversion

But I don't see how there's any hinting involved.

-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227


Thread (43 messages)

« previous php.internals (#58719) next »