Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34330 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18552 invoked by uid 1010); 3 Jan 2008 18:36:57 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 18537 invoked from network); 3 Jan 2008 18:36:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jan 2008 18:36:56 -0000 Authentication-Results: pb1.pair.com header.from=markus@fischer.name; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=markus@fischer.name; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fischer.name from 62.179.121.49 cause and error) X-PHP-List-Original-Sender: markus@fischer.name X-Host-Fingerprint: 62.179.121.49 viefep31-int.chello.at Solaris 10 (beta) Received: from [62.179.121.49] ([62.179.121.49:60106] helo=viefep31-int.chello.at) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CC/A7-20810-64B2D774 for ; Thu, 03 Jan 2008 13:36:55 -0500 Received: from genuine.home ([84.112.136.139]) by viefep31-int.chello.at (InterMail vM.7.08.02.02 201-2186-121-104-20070414) with ESMTP id <20080103183651.XGIM15329.viefep31-int.chello.at@genuine.home>; Thu, 3 Jan 2008 19:36:51 +0100 Received: from chello084112136139.36.11.vie.surfer.at ([84.112.136.139] helo=[192.168.1.51]) by genuine.home with esmtpa (Exim 4.50) id 1JAUop-00084I-5B; Thu, 03 Jan 2008 19:29:29 +0100 Message-ID: <477D2B40.9010302@fischer.name> Date: Thu, 03 Jan 2008 19:36:48 +0100 User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Alain Williams CC: Sam Barrow , Tomi Kaistila , internals@lists.php.net References: <200801031903.01980.tomi@cumulo.fi> <1199380881.15292.11.camel@sbarrow-desktop> <20080103172813.GQ7861@mint.phcomp.co.uk> In-Reply-To: <20080103172813.GQ7861@mint.phcomp.co.uk> X-Enigmail-Version: 0.95.5 OpenPGP: id=C2272BD0; url=http://markus.fischer.name/my_public_key.txt Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -16 X-Spam-Level: - X-Spam-Report: Spam detection software, running on the system "genuine.home", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, Alain Williams wrote: > On Thu, Jan 03, 2008 at 12:21:21PM -0500, Sam Barrow wrote: >> I think E_WARNING would be appropriate. That's what happens when you >> omit an argument to a function right? > > The other thing to note about type hinting is that it could result in faster code. > The value is checked and if needed converted (eg string -> integer) when the > function is called; it then need not be converted again when it is used in > the function. This will presumably be a win if the value is used more than once. [...] Content analysis details: (-1.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -3.3 ALL_TRUSTED Did not pass through any untrusted hosts -0.4 BAYES_05 BODY: Bayesian spam probability is 1 to 5% [score: 0.0253] 2.0 RCVD_IN_SORBS_DUL RBL: SORBS: sent directly from dynamic IP address [84.112.136.139 listed in dnsbl.sorbs.net] 0.0 AWL AWL: From: address is in the auto white-list Subject: Re: [PHP-DEV] RE: Optional scalar type hinting From: markus@fischer.name (Markus Fischer) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, Alain Williams wrote: > On Thu, Jan 03, 2008 at 12:21:21PM -0500, Sam Barrow wrote: >> I think E_WARNING would be appropriate. That's what happens when you >> omit an argument to a function right? > > The other thing to note about type hinting is that it could result in faster code. > The value is checked and if needed converted (eg string -> integer) when the > function is called; it then need not be converted again when it is used in > the function. This will presumably be a win if the value is used more than once. I don't think that automagic conversion of types is a good idea. When the type hint says I want an integer, then only integer should be accepted; no casting should be done. It may give predictable results according to the documentation but not always very intuitive. I sense a possible small trap, and after all type hints should help developers get code right and spot problems easier without less work. PHP supports explicit casting and that should be used for that. Because if this results in a problem alter in the code you know who to blame: yourself, and not the automagic behavior of PHP. my 2c, - - Markus -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHfStA1nS0RcInK9ARAu/dAKDNOMC7M1X8CyrjyCrpzt0/oiLsCgCg2YSY YAUYre0HTc3dLxsbHTu7+Ik= =KXMz -----END PGP SIGNATURE-----