Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44606 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60809 invoked from network); 1 Jul 2009 20:50:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jul 2009 20:50:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.117 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.117 us-mr1.zend.com Linux 2.4/2.6 Received: from [63.205.162.117] ([63.205.162.117:34212] helo=us-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A4/B3-43450-01CCB4A4 for ; Wed, 01 Jul 2009 16:50:25 -0400 Received: from us-gw1.zend.com (us-ex1.zend.net [192.168.16.5]) by us-mr1.zend.com (Postfix) with ESMTP id 9A856E12C3; Wed, 1 Jul 2009 13:39:19 -0700 (PDT) Received: from [192.168.16.83] ([192.168.16.83]) by us-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 1 Jul 2009 13:50:58 -0700 Message-ID: <4A4BCC0D.6000704@zend.com> Date: Wed, 01 Jul 2009 13:50:21 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: Hannes Magnusson CC: Ilia Alshanetsky , PHP internals References: <4A4BA5C8.1020204@zend.com> <4A4BAE7B.3020601@zend.com> <39D0B97E-3A70-44E3-B1BC-D68A0E58CA76@prohost.org> <4A4BC731.1020909@zend.com> <7f3ed2c30907011342y24ccd2c7te5f7c273f001fa7a@mail.gmail.com> In-Reply-To: <7f3ed2c30907011342y24ccd2c7te5f7c273f001fa7a@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 01 Jul 2009 20:50:58.0185 (UTC) FILETIME=[A2961F90:01C9FA8D] Subject: Re: [PHP-DEV] RFC: Type hinting revisited for PHP 5.3 From: stas@zend.com (Stanislav Malyshev) Hi! >> Right. So we would have two APIs for types - one coercing (for internals) >> and one strict (for user functions), which would work in entirely different >> way. Is that good? > > How is that different from what we have already? Well, it's different in a way that right now we have typehints only for classes and arrays (which work the same internal and external) and conversions for internals and some places user code (which use the same logic, just in user code you can't apply them to function parameters automatically). With this patch, we won't have one logic anymore - we'd have two logics - one for typehinted functions (reject everything that doesn't match the type) and one for the rest of the language (try to coerce types). Two logics in one language is usually not good. > Internally you type hint (arginfo) what you want, in userland you'll > be able to do that too (int $foo). No, internal typehint doesn't work the way "int" typehint works with this patch. Internal typehint (zend_parse_parameters) do conversions, see zend_API.c. Only typehint that would resemble what internals do is "numeric" (well, and "scalar", but it doesn't really have internal counterpart). > I don't understand what "work entirely different" you are talking > about. This is how PHP already works. No, that's exactly how PHP _doesn't_ work - there's always type coercion, not just matching of zval types. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com