Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37105 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52278 invoked from network); 17 Apr 2008 18:10:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2008 18:10:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=chrisstocktonaz@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=chrisstocktonaz@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.200.171 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: chrisstocktonaz@gmail.com X-Host-Fingerprint: 209.85.200.171 wf-out-1314.google.com Received: from [209.85.200.171] ([209.85.200.171:53761] helo=wf-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A5/8F-05127-D7297084 for ; Thu, 17 Apr 2008 14:10:05 -0400 Received: by wf-out-1314.google.com with SMTP id 27so122437wfd.26 for ; Thu, 17 Apr 2008 11:10:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=0ygw66ssa1aO5KvxGS1Go76Ua022LVs89Ywnt5MRQo0=; b=SiQJq1VDX7UiZ7tYQD1ccG4ixn/PuFbyMMEs69/WkISGqOevkgGJa1LmRD4zteUtm2S35a58lXh/uMBk072kBmFPBmaY0CbaCzjGuG7TiXpVIkGm9cyLUBXJmyT7ZBbgpAtBp9VXractvz5wUtGYxb8eeXbltIlK9QY9LE4ydzI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=Us7LAT8t2yDFqCyPx3wZ9cx263GpvrA1YPGb6EcdnjONb7fdhXprJrmrJlCVwv2JF2e8913FD0U7wiQRT8iWcEUSzZQT27FNmVsVXnwPDI4ppxO/NUbo8BGb/PXpyGrIVeO7nAaza9dmKG9wXWLMJKv7TNRosxYzunfrxG1kMt8= Received: by 10.142.105.13 with SMTP id d13mr503429wfc.275.1208455802861; Thu, 17 Apr 2008 11:10:02 -0700 (PDT) Received: by 10.142.178.15 with HTTP; Thu, 17 Apr 2008 11:10:02 -0700 (PDT) Message-ID: Date: Thu, 17 Apr 2008 11:10:02 -0700 To: "Stanislav Malyshev" Cc: internals@lists.php.net In-Reply-To: <48078FF9.7040304@zend.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1249_9535815.1208455802841" References: <46ccd1ab0804170742g142ed562t4f03339da549a820@mail.gmail.com> <48077BD2.2000107@zend.com> <48078168.1070801@zend.com> <48078FF9.7040304@zend.com> Subject: Re: [PHP-DEV] [RFC] Strict type hints (parameter and return value) From: chrisstocktonaz@gmail.com ("Chris Stockton") ------=_Part_1249_9535815.1208455802841 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thu, Apr 17, 2008 at 10:59 AM, Stanislav Malyshev wrote: > Hi! > > Seeing how you work for zend I thought maybe you have used the zend > > framework = ) Sorry in my example I used "int" instead of "numeric", but my > > point is the same, grep in zend framework for is_bool. > > > > It might come as a surprise to you, but I did not write whole Zend > Framework personally :) Moreover, as even more surprise I did not even > inspect personally each line of code. As a final shock, I am not convinced > functions in PHP should throw exceptions when parameters don't match - and > even if they do, first they should attempt to make sense of parameters > (which makes string hints like "integer" and "string" make no sense - you > can convert a lot of things to int or string). Even if they can't, it's much > better to be handled on user code level with error message that makes sense > and way that makes sense for application - but I could kind of live with the > scenario where these hints would work as internal function types work now. > However, that's not what is proposed - what is proposed is that if you've > got int typehint, '1' would be rejected. Having such restriction makes no > sense and goes contrary to what PHP and dynamic languages in general are. That first part made me laugh, hehe. I wanted to just point out that your company was a good example of how code could be minimized using type checks. I understand your philosophy with dynamic types in php, but there are times that these dynamic types have really shot people in the foot and added exploits and bad coding practices, which is why high-quality frameworks push users to use correct types, zf is just one of many examples my friend. I get your point of 12 and '12', which is why I proposed earlier numeric hinting would be very appropriate. -Chris ------=_Part_1249_9535815.1208455802841--