Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37145 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32289 invoked from network); 19 Apr 2008 08:24:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Apr 2008 08:24:58 -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.40 cause and error) X-PHP-List-Original-Sender: markus@fischer.name X-Host-Fingerprint: 62.179.121.40 viefep20-int.chello.at Solaris 10 (beta) Received: from [62.179.121.40] ([62.179.121.40:41104] helo=viefep20-int.chello.at) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 19/A9-06290-95CA9084 for ; Sat, 19 Apr 2008 04:24:58 -0400 Received: from genuine.home ([84.112.136.139]) by viefep20-int.chello.at (InterMail vM.7.08.02.02 201-2186-121-104-20070414) with ESMTP id <20080419082453.EQPG6831.viefep20-int.chello.at@genuine.home>; Sat, 19 Apr 2008 10:24:53 +0200 Received: from ncvielp07.home ([192.168.1.51]) by genuine.home with esmtpa (Exim 4.50) id 1Jn8Kn-0003W5-Mc; Sat, 19 Apr 2008 10:22:10 +0200 Message-ID: <4809AC58.4070700@fischer.name> Date: Sat, 19 Apr 2008 10:24:56 +0200 User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Lukas Kahwe Smith CC: Lars Strojny , Felipe Pena , internals@lists.php.net References: <46ccd1ab0804170742g142ed562t4f03339da549a820@mail.gmail.com> <1208466868.4430.10.camel@localhost> <1208478266.5763.14.camel@pena> <1208500782.4430.14.camel@localhost> In-Reply-To: X-Enigmail-Version: 0.95.6 OpenPGP: id=C2272BD0; url=http://markus.fischer.name/my_public_key.txt Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -32 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: Lukas Kahwe Smith wrote: > Suddenly I need to ensure that all my variables have the proper types. > So what will people do? They will start forcing type juggeling manually > before they call the library in question. Since this is the glue code, > its the kind of code you have to write day in day out. So maybe an > "(int)" here or there is not so much more code to type, but you can > already see that code you safe on one end, you have to start adding on > the other, the one which you write more often. More importantly, in some > cases simple type juggeling with "(int)" will not be sufficient, you > might have to do some minor checks etc. In the past library authors did > this as part of the code that the strict type hinting camp is now hoping > to remove. So again more code in my glue code. [...] Content analysis details: (-3.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -3.3 ALL_TRUSTED Did not pass through any untrusted hosts 0.0 BAYES_50 BODY: Bayesian spam probability is 40 to 60% [score: 0.4961] Subject: Re: [PHP-DEV] [RFC] Strict type hints (parameter and return value) From: markus@fischer.name (Markus Fischer) Lukas Kahwe Smith wrote: > Suddenly I need to ensure that all my variables have the proper types. > So what will people do? They will start forcing type juggeling manually > before they call the library in question. Since this is the glue code, > its the kind of code you have to write day in day out. So maybe an > "(int)" here or there is not so much more code to type, but you can > already see that code you safe on one end, you have to start adding on > the other, the one which you write more often. More importantly, in some > cases simple type juggeling with "(int)" will not be sufficient, you > might have to do some minor checks etc. In the past library authors did > this as part of the code that the strict type hinting camp is now hoping > to remove. So again more code in my glue code. You're absolutely right about that glue code. However, I think this serves as a benefit for the developers using the library/framework/component/whatever. It reduces the chances of passing wrong types around, he's forced to grapple with the parameter in a proper way and would, ahead of executing code with possible wrong values, have a change to correct it. Yes, the code can likely look like $foo->bar( (int)$baz, (string)$sober, (bool)$result['column_checkbox'] ); but this means he is really forced to think what he is really passing. It will not raise the overall code quality in a major way, but it helps developers on both sides (devs of libraries, devs of using the libraries) to ensure proper passing of varaibles. It is optional. And it will likely be only used by library/framework/component/whatever. But for them, I think, it's a win. sincerely, - Markus