Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37088 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16465 invoked from network); 17 Apr 2008 17:06:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2008 17:06:22 -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.174 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.174 wf-out-1314.google.com Received: from [209.85.200.174] ([209.85.200.174:35184] helo=wf-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9B/D7-05127-D8387084 for ; Thu, 17 Apr 2008 13:06:21 -0400 Received: by wf-out-1314.google.com with SMTP id 27so105145wfd.26 for ; Thu, 17 Apr 2008 10:06:17 -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=YYwcRLG9HsKZWtdVJC//zmSG47N+c1ssedImOzqx/hk=; b=cCYrM7YQDVGOxB2+QLJRJecNyi1kJObQ14IjgW0XkCoIhjLvyEmwxlt3WurjgUkfgSahdPKoa801vfFQ9YL0k1LTkAhtc7nddyCB4VMhZd8H3P07aOAAdCmCRxTtx83HR+n8PjcdSrDjDc6NMsjSR8b2J4eAROX4tb0OhaH3OUg= 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=L7C+SjKQ2k5iIS9Lell+LoNIXmpaaaMSMZNaKB5B1xo90ymK/Xn5XY6YjPZZS8tuPvqMXdkBJNCgMqlUVxOHpomW0ivzfpEt/kSUa7qSQNXmBvzwRJoie8SQDwKsL0I2vHJK8UTNk4QkLxNykyKDPFC/z/+tG2NEc0pEEtv1XPc= Received: by 10.142.103.6 with SMTP id a6mr509014wfc.21.1208451977414; Thu, 17 Apr 2008 10:06:17 -0700 (PDT) Received: by 10.142.178.15 with HTTP; Thu, 17 Apr 2008 10:06:17 -0700 (PDT) Message-ID: Date: Thu, 17 Apr 2008 10:06:17 -0700 To: "Stanislav Malyshev" Cc: "Felipe Pena" , internals@lists.php.net In-Reply-To: <48078168.1070801@zend.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_921_12622686.1208451977405" References: <46ccd1ab0804170742g142ed562t4f03339da549a820@mail.gmail.com> <48077BD2.2000107@zend.com> <48078168.1070801@zend.com> Subject: Re: [PHP-DEV] [RFC] Strict type hints (parameter and return value) From: chrisstocktonaz@gmail.com ("Chris Stockton") ------=_Part_921_12622686.1208451977405 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thu, Apr 17, 2008 at 9:57 AM, Stanislav Malyshev wrote: > What's the use of such code? If $var is '1' and not 1, what's the use of > throwing an exception and having to handle it later (basically by failing > the task, since you don't know how to do foo() now) - instead of just doing > with that 1 what was intended for? There's no any difference between 1 and > '1' that can be important to anybody. Only difference is the way it is > represented in underlying bits in zvals, about which nobody should ever > care. That's like making function that would accept only arguments that has > 3'rd bit of pointer set to 1 and 5th bit set to 0, and reject all others. No > sane application should ever behave this way. Writing such function is just > plain wrong, it replaces the substance of programming with nitpicking over > the details that are not important. Whole phenomenon of dynamic languages > has grown on the principle of liberating people from caring for bits and > concentrate on substance, and now you try to drag the bits back in. > So every time you call foo you need try/catch? And that's supposed to be > _good_? Somebody missed the point... 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 does what you are complaining about: From: Zend_Pdf_Element_Numeric public function __construct($val) { if ( !is_numeric($val) ) { throw new Zend_Pdf_Exception('Argument must be numeric'); } $this->value = $val; } That could be... public function __construct(numeric $val) { $this->value = $val; } So, let's re-visit my point of "less code bloat".... ------=_Part_921_12622686.1208451977405--