Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44895 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89995 invoked from network); 10 Jul 2009 10:37:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jul 2009 10:37:44 -0000 Authentication-Results: pb1.pair.com header.from=ionut.g.stan@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=ionut.g.stan@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.220 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ionut.g.stan@gmail.com X-Host-Fingerprint: 209.85.220.220 mail-fx0-f220.google.com Received: from [209.85.220.220] ([209.85.220.220:48442] helo=mail-fx0-f220.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A5/A3-23850-7F9175A4 for ; Fri, 10 Jul 2009 06:37:43 -0400 Received: by fxm20 with SMTP id 20so734108fxm.23 for ; Fri, 10 Jul 2009 03:37:40 -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 :user-agent:mime-version:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=iT81e7nxWSWqGEWjE51eWepkHIUv7jbZIHeJ5UiDCj4=; b=Cqtv2DysaB0/7HBjMZLumuST22KLRJmFe+JNLOMvLYgr1XIY78HeKdNbkbRqMpLpz7 pySza77O1kVevB/vW7LvBxnrRkMZ2j2JrpwG9OoDF8tFiukSa9maBv29NRdp1VwHrtjV hLm3P00RxAfdxi+UOQQqq0CWYfkLiW5vsoeS4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; b=iIX6P0lQ2Bs6JwF+25D7fxxoCZ8w2h+hPu56qG8V2rTf+tITXWM6lxqEFdM+p0Gn4h iP6VjSaAHMyJeKWUBfTJEBFqsbpsdVZQNBgUu9i//AfSKzHD+Ct/52u1n+XPj8xmkSio umPKKiX121mFx5mp/BXXUiZf8xPtpeJtThu4k= Received: by 10.103.108.18 with SMTP id k18mr982040mum.40.1247222260593; Fri, 10 Jul 2009 03:37:40 -0700 (PDT) Received: from ?10.0.0.187? (mail.cmbtravel.ro [84.234.105.22]) by mx.google.com with ESMTPS id e8sm4668833muf.36.2009.07.10.03.37.39 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 10 Jul 2009 03:37:39 -0700 (PDT) Message-ID: <4A571981.80900@gmail.com> Date: Fri, 10 Jul 2009 13:35:45 +0300 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b3pre) Gecko/20090223 Thunderbird/3.0b2 MIME-Version: 1.0 CC: internals@lists.php.net References: <7.0.1.0.2.20090708224156.0ac5a438@zend.com> <312025EF-84D0-4411-A0A7-4F0379C3105F@pooteeweet.org> <22CAD497EA2F476DAECEF9302D0B087A@pc> <98b8086f0907091150r47e7a103jaa50fcf7d5b32186@mail.gmail.com> <4A568B33.9000501@gmail.com> <98b8086f0907091744w7ab598dckc427d0a9484664b2@mail.gmail.com> <20090710102302.GC20283@gerbil.thgnet.it> In-Reply-To: <20090710102302.GC20283@gerbil.thgnet.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Type hinting - Request for Discussion From: ionut.g.stan@gmail.com ("Ionut G. Stan") On 7/10/2009 13:23, Giovanni Giacobbi wrote: > On Fri, Jul 10, 2009 at 02:44:52AM +0200, troels knak-nielsen wrote: > [...] > >> For example, instead of: >> >> function addFive(int $x) { >> return $x + 5; >> } >> >> You would simply do: >> >> function addFive(is_numeric $x) { >> return $x + 5; >> } >> >> Since $x is guaranteed to be numeric, it is safe to to arithmetic on >> it. No reason to explicitly type cast here. >> >> I like it too. Not only it solves the initial problem, but it also allows userland extensions. For example, the current patch does not provide checks for callables, but we already have is_callable in the core. -- Ionut G. Stan I'm under construction | http://igstan.blogspot.com/