Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37150 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44911 invoked from network); 20 Apr 2008 16:25:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2008 16:25:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=cschneid@cschneid.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=cschneid@cschneid.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain cschneid.com from 195.226.6.51 cause and error) X-PHP-List-Original-Sender: cschneid@cschneid.com X-Host-Fingerprint: 195.226.6.51 darkcity.gna.ch Linux 2.6 Received: from [195.226.6.51] ([195.226.6.51:55764] helo=mail.gna.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 74/BA-19592-18E6B084 for ; Sun, 20 Apr 2008 12:25:38 -0400 Received: from localhost (localhost [127.0.0.1]) by darkcity.gna.ch (Postfix) with ESMTP id 7507216656A; Sun, 20 Apr 2008 18:25:34 +0200 (CEST) Received: from unknown by localhost (amavisd-new, unix socket) id client-XXrZxK8b; Sun, 20 Apr 2008 18:25:31 +0200 (CEST) Received: from box.local (84-72-92-81.dclient.hispeed.ch [84.72.92.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTP id E6665B1AA4; Sun, 20 Apr 2008 18:25:30 +0200 (CEST) Message-ID: <480B6E7A.8040803@cschneid.com> Date: Sun, 20 Apr 2008 18:25:30 +0200 User-Agent: Thunderbird 2.0.0.12 (Macintosh/20080213) MIME-Version: 1.0 To: Markus Fischer CC: internals@lists.php.net References: <46ccd1ab0804170742g142ed562t4f03339da549a820@mail.gmail.com> <1208466868.4430.10.camel@localhost> <1208478266.5763.14.camel@pena> <1208500782.4430.14.camel@localhost> <4809AC58.4070700@fischer.name> In-Reply-To: <4809AC58.4070700@fischer.name> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at gna.ch Subject: Re: [PHP-DEV] [RFC] Strict type hints (parameter and return value) From: cschneid@cschneid.com (Christian Schneider) Markus Fischer schrieb: > $foo->bar( (int)$baz, (string)$sober, (bool)$result['column_checkbox'] ); > but this means he is really forced to think what he is really passing. I'm surprised that you find this desirable. > 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. As explained before I consider a good framework to take work *off* of me, not make me think about details like whether $result['column_checkbox'] is 0, false or null to signify "option not checked". Why should I care? Typos in your parameters should be detected by testing (or something we've been thinking to implement as a PHP patch for a while but haven't gotten around yet: a warning about variables which are only used once). I would even go one step further and compare this approach to the UAC in Windows Vista: It is annoying and at the same time teaches users to ignore warnings by simply "clicking Ok" (casting) because 99% of the time that's the right thing to do anyway. A framework is written once but (hopefully) used any times. Why not make the framework robust enough to spare those details from its users? I'm tempted to call this approach unPHPonic (-:C Ok, my horse is officially dead now ;-) - Chris