Re: Scalar Type Hinting
From: Alan Knowles Date: Wed, 07 Mar 2012 16:31:14 +0000 Subject: Re: Scalar Type Hinting References: 1 2 3 Groups: php.internals Request: Send a blank email to [email protected] to get a copy of this message
Comment in-line below... On Wednesday, March 07, 2012 07:10 AM, Simon Schick wrote:Hi,: It got quite around that because we have some RFCs to this where the functionality seems to be defined as the people thought it should be. Otherwise they can raise their hands and write a mail that they want to update the RFC - but as there's no one doing that, I think we're quite close to what we wanted. Take a look at it and feel free to add your ideas in this thread. https://wiki.php.net/rfc/parameter_type_casting_hints https://wiki.php.net/rfc/object_cast_to_typesBeen watching this for a while, got slightly interested in the parameter casting thing, but then ran a little test http://www.roojs.com/examples/types.php Casting on PHP may help the code inside the function, but the result is some weird and wonderful magic for the calling code, not to mention that the docs for (int) casting say the behavior may change, don't expect it to work like that forever.. You could try some kind of stricter casting. Where odd conversions between array/object <-> bool/int/float/string do not work on parameter casting .. but then you end up with two types of casting ... Anyway, will go back to lurking for a while.. Regards AlanBye Simon 2012/3/6 Kris Craig<[email protected]>Wow no offense, but your timing is terrible, Raymond! We've been going back and forth on this for the past couple weeks now, though the discussion has quieted for the moment. I would suggest you go through some of the recent posts on Internals. Right now there basically is no solid consensus on this issue, though some of us have been working to change that. But as it stands now, I'm not aware of any plans to introduce expanded typing of any kind in the foreseeable future. And even if we did, I highly doubt it would happen before PHP 6. --Kris On Mon, Mar 5, 2012 at 6:20 PM, Raymond Irving<[email protected]> wrote:Hello, I came across some info on the web that states that scalar type hintingwasadded to the PHP trunk but it did not make it's way into 5.4 because of objections from the community. Will it ever make it's way into 5.5? I know PHP is considered to be a weak typed language but it should alsobeabout freedom. Freedom for a PHP developer to choose to use scalar type hinting whenever he/she sees the need. Best regards, __ Raymond
Thread (43 messages)
« previous | php.internals (#58744) | next » |
---|