Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44610 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68328 invoked from network); 1 Jul 2009 21:23:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jul 2009 21:23:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=hannes.magnusson@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=hannes.magnusson@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.220.159 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: hannes.magnusson@gmail.com X-Host-Fingerprint: 72.14.220.159 fg-out-1718.google.com Received: from [72.14.220.159] ([72.14.220.159:9796] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E4/35-43450-6D3DB4A4 for ; Wed, 01 Jul 2009 17:23:35 -0400 Received: by fg-out-1718.google.com with SMTP id 13so1002067fge.0 for ; Wed, 01 Jul 2009 14:23:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=GvAdiHGfuVheCwnffHMEZedkfsct+Dd6StDOOo0IIvM=; b=Ff/Jf/McG3sIyB+Sip/g8OqKjLouHLSHfn9OGQp4f6ThU3YYygehAsxHI35wgbfr/7 2RvBXWuSM3zeWfjjIYj3R8hZfxcCI6HafWGrVqzOHVuYe5atdWrbQZgPS405ycVZIozb 6owLTcxsfm/meJO5iXfg5s4y0QdQxU1XGbVHQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=HwLhSscEzK+f7X4w8xratzB0STNRAFItR0LCHh3QmRg4yY1g0Ajp0Um2cjm7Xl2qIV kOwuIudLPuzc+qLvX4Hu6HwacLy6tH2we8grvLVtlKMjQ2V2LWrqGbXcSRHiW0hdgCbx E0nCB3jJE+qZ5aalNaQEAVduuJgmzBI/JmuX4= MIME-Version: 1.0 Received: by 10.86.23.9 with SMTP id 9mr4708152fgw.5.1246483411939; Wed, 01 Jul 2009 14:23:31 -0700 (PDT) In-Reply-To: References: <4A4BA5C8.1020204@zend.com> <4A4BAE7B.3020601@zend.com> <39D0B97E-3A70-44E3-B1BC-D68A0E58CA76@prohost.org> <4A4BC731.1020909@zend.com> <7f3ed2c30907011342y24ccd2c7te5f7c273f001fa7a@mail.gmail.com> <4A4BCC0D.6000704@zend.com> <7f3ed2c30907011402taa51848h56dfff924c59a6cb@mail.gmail.com> Date: Wed, 1 Jul 2009 23:23:31 +0200 Message-ID: <7f3ed2c30907011423p28e693c1nc4da1e2b20ca8a45@mail.gmail.com> To: Paul Biggar Cc: Stanislav Malyshev , Ilia Alshanetsky , PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC: Type hinting revisited for PHP 5.3 From: hannes.magnusson@gmail.com (Hannes Magnusson) On Wed, Jul 1, 2009 at 23:07, Paul Biggar wrote: > So, what you're saying is, the patch already handles coercion? If > that's the case, then problem solved. The patch offers scalar type _hinting_. Not type _casting_. Type hinting in PHP works very simply: If the value doesn't type-match the argument information (arginfo internally) then it will be rejected and E_RECOVERABLE_ERROR thrown. In most circumstances that error is fatal. However. If the user chooses then he can ignore that error (by creating his own error handler) and continue the execution. Type _hinting_ is in no way related to type _casting_. Furthermore, the patch introduces couple of new types, "scalar" and "numeric". These are "magic types" and do value-to-real-type comparison. No type casting. The scalar type hint accepts strings, booleans, ints and floats. The numeric type hint accepts strings (that pass is_numeric()), booleans, ints and floats. -Hannes