Re: Strict typing

From: Date: Wed, 11 Aug 2010 04:41:01 +0000
Subject: Re: Strict typing
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-49309@lists.php.net to get a copy of this message
On 10-08-11 12:03 AM, Josh Davis wrote:
On 11 August 2010 02:50, Stas Malyshev<smalyshev@sugarcrm.com> wrote:
Hi!
First of all, I am talking about the typehinting syntax and mechanism here. As Derick pointed out, current typehints are strict.
Talking about "strict" vs. "non-strict" for class types is meaningless.
By "strict" typehints I meant that no typecasting occurs. Personally I'm not fan of the "strict" vs "weak" denomination used here either. I'd rather call them typechecking vs smartcasting.
I'd prefer jugglehints... since I'd like PHP to coerce whatever I pass as a parameter to the "hinted" type. This is the PHP way... type juggling to save the developer the hassle. If I set a jugglehint of "int" then I would expect the value to be coerced to an integer regardless of whether 12.0, 12, "12", or "12 brown cows" is passed. The process of type juggling is well documented and has been for years. Why change that? Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized.

« previous php.internals (#49309) next »