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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, November 21, 2006 12:11 pm, Jared Farrish wrote:
> On 11/21/06, Richard Lynch <ceo@xxxxxxxxx> 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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux