Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58744 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7294 invoked from network); 7 Mar 2012 16:31:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2012 16:31:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=alan@akbkhome.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=alan@akbkhome.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain akbkhome.com designates 202.81.246.113 as permitted sender) X-PHP-List-Original-Sender: alan@akbkhome.com X-Host-Fingerprint: 202.81.246.113 akbkhome.com Received: from [202.81.246.113] ([202.81.246.113:59998] helo=akbkhome.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/24-15180-16D875F4 for ; Wed, 07 Mar 2012 11:31:33 -0500 Received: from wideboyhd.local ([192.168.0.28]) by akbkhome.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Mailfort v1.2) (envelope-from ) id 1S5Jlp-0002pn-CV for internals@lists.php.net; Thu, 08 Mar 2012 00:31:21 +0800 Message-ID: <4F578D52.4080704@akbkhome.com> Date: Thu, 08 Mar 2012 00:31:14 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-mailfort-sig: 79f0dc49522c09b7baae83a3dc61dbed Subject: Re: [PHP-DEV] Scalar Type Hinting From: alan@akbkhome.com (Alan Knowles) 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_types Been 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 Alan > > Bye > Simon > > 2012/3/6 Kris Craig > >> 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 wrote: >> >>> Hello, >>> >>> I came across some info on the web that states that scalar type hinting >> was >>> added 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 also >> be >>> about freedom. Freedom for a PHP developer to choose to use scalar type >>> hinting whenever he/she sees the need. >>> >>> >>> Best regards, >>> __ >>> Raymond >>>