Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33159 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48670 invoked by uid 1010); 15 Nov 2007 16:07:24 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 48653 invoked from network); 15 Nov 2007 16:07:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Nov 2007 16:07:24 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@googlemail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=rquadling@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.146.178 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@googlemail.com X-Host-Fingerprint: 209.85.146.178 wa-out-1112.google.com Received: from [209.85.146.178] ([209.85.146.178:43167] helo=wa-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C0/5F-63493-7BE6C374 for ; Thu, 15 Nov 2007 11:07:23 -0500 Received: by wa-out-1112.google.com with SMTP id l24so743719waf for ; Thu, 15 Nov 2007 08:07:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=HbzYjJUGh9SzU1uFT+EGxnchT073NypOV89yjgpo2QY=; b=tp0ooUK380F3pTBxOd3NbP2NPADmUg75gnr62bIqCEh3uUblc2vtp0aIPQa5ITCj12oHnfmLGXSM17PrXv+CWgP7IAgXjR3q79C8bPafOJqSdkBsKiVqYHppfYZ2MUAyU60BQLCjlih98zW0h9e64trEfsHe9vj260/Js80XsXQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=NaomlknILZwf3kn8ovkNpvFDZu6bdtwJfRZzRRbznI6OtTXt2Pl/Z3iH/kYoIcVFasbXdtDghCD1jXizsncuqK0ftaGMFIbnO+2/YKBoag6pbMS9XBsFvXIaYczmpIMmL/yUPsdavOuU13ryX4GKR+Izu17npAFcn46Wj3aDsbc= Received: by 10.114.198.1 with SMTP id v1mr865102waf.1195142824710; Thu, 15 Nov 2007 08:07:04 -0800 (PST) Received: by 10.114.210.8 with HTTP; Thu, 15 Nov 2007 08:06:59 -0800 (PST) Message-ID: <10845a340711150806i186e6363k9c1fcae62c862f12@mail.gmail.com> Date: Thu, 15 Nov 2007 16:06:59 +0000 Reply-To: RQuadling@GoogleMail.com To: "Sam Barrow" Cc: internals@lists.php.net In-Reply-To: <1195140437.23612.5.camel@sbarrow-desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1195140437.23612.5.camel@sbarrow-desktop> Subject: Re: [PHP-DEV] [PATCH] Optional scalar type hinting From: rquadling@googlemail.com ("Richard Quadling") On 15/11/2007, Sam Barrow wrote: > > I found a patch by Derick online to allow for scalar type hinting, and > made it work with the newest snapshot of PHP 5.3. I also added the > ability to type hint for resources. I would like to ask that it be added > to the next PHP release. It allows type hinting for int, float, bool, > string, resource, and object, I also added the ability to use the > secondary keywords for all of these types (such as double, real, long, > etc.). > > It will maintain 100% backwards compatibility, as the type hinting is > 100% optional, implemented in the same way as array/class type hinting. > > I have the patch on my PC, please let me know where and when i can > submit it. I'd be happy to do the patching and submission myself, just > asking for permission here. What happens for type conversion? Is the param cast to the hinted type? The idea of type hinting for array and class is to make sure you get something appropriate. Rarely would you think of an array and cast it as an integer (or vice versa), so it makes sense. But with a string ("0"), an integer (0) or a boolean (false), they are all the same, so does this mean we would be having to cast all the params to the function/method? -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!"