Re: Help with typecasting by default in the function parameter list

From: Date: Tue, 21 Nov 2006 23:20:16 +0000
Subject: Re: Help with typecasting by default in the function parameter list
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-245003@lists.php.net to get a copy of this message
On Tue, November 21, 2006 12:11 pm, Jared Farrish wrote: > On 11/21/06, Richard Lynch <ceo@l-i-e.com> wrote: >> >> >> It won't work, and if the syntax DID parse, it would probably be >> "type >> hinting" rather than "type casting" which means it would possibly >> throw an error/notice/warning/whatever if your data coming in was >> not >> (int) type. >> > > I had thought about it "meaning" typehinting instead of typecasting to With or without the () I'd expect 'int' in an arglist to be type-hinting, not type-casting, as that's how most other languages work... Not saying it couldn't be done, just that it would require a mental adjustment. And, of course, for now: function foo ($x, $y){ $x = (int) $x; $y = (int) $y; } Not that big a deal, it seems to me, to get the type coercion. Type-hinting is far more complex to achieve in UserLand code... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.general (#245003) next »