Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44799 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71675 invoked from network); 7 Jul 2009 22:39:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Jul 2009 22:39:17 -0000 Authentication-Results: pb1.pair.com header.from=johannes@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 83.243.58.134 as permitted sender) X-PHP-List-Original-Sender: johannes@php.net X-Host-Fingerprint: 83.243.58.134 mailout2.netbeat.de Linux 2.6 Received: from [83.243.58.134] ([83.243.58.134:48830] helo=mailout2.netbeat.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C1/07-37453-39EC35A4 for ; Tue, 07 Jul 2009 18:39:16 -0400 Received: (qmail 2284 invoked by uid 89); 7 Jul 2009 23:14:02 -0000 Received: from unknown (HELO ?192.168.1.102?) (johannes%schlueters.de@88.217.59.206) by mailout2.netbeat.de with ESMTPA; 7 Jul 2009 23:14:02 -0000 To: Ilia Alshanetsky Cc: PHP internals In-Reply-To: <2D0F5226-EBCA-4B45-BF01-8ED1C643976C@prohost.org> References: <2D0F5226-EBCA-4B45-BF01-8ED1C643976C@prohost.org> Content-Type: text/plain Date: Wed, 08 Jul 2009 00:39:04 +0200 Message-ID: <1247006344.3760.164.camel@goldfinger.johannes.nop> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Type hinting/casting request for vote From: johannes@php.net (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Mon, 2009-07-06 at 20:52 -0400, Ilia Alshanetsky wrote: > Last week or so there was a fairly detailed discussion on the > internals list regarding type hinting based on my original patch. > Since then the patch has been revised to address the major concerns > that were identified (breakage of binary compatibility) as well > extended with additional functionality (object hint, type casting, > reflection support, etc...). > > The final patch is available here: http://ilia.ws/patch/type_hint_53_v2.txt > The test suit is available here: http://ia.gd/patch/type_hint_tests.tar.bz2 If I read the patch correctly it still breaks binary compatibility: -#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1, #classname, sizeof(#classname)-1, 0, allow_null, pass_by_ref, 0, 0 }, -#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, sizeof(#name)-1, NULL, 0, 1, allow_null, pass_by_ref, 0, 0 }, +#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1, #classname, sizeof(#classname)-1, IS_CLASS, allow_null, pass_by_ref, 0, 0 }, +#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, sizeof(#name)-1, NULL, 0, IS_ARRAY, allow_null, pass_by_ref, 0, 0 }, Having an "old" 5.3 extension with a typehint expecting an array arg_info.array_type_hint will be set to 1. The newly compiled engine with this patch will then do + /* existing type already matches the hint or forced type */ + if (Z_TYPE_P(arg) == cur_arg_info->array_type_hint || Z_TYPE_P(arg) == (cur_arg_info->array_type_hint ^ (1<<7))) { as it's main type check, but Z_TYPE_P(arg) will be IS_ARRAY (5) which doesn't match the 1 provided by the old extension, other checks in there will fail too, so the valid param will be rejected whereas an integer (IS_LONG 1) will be accepted where the extension expects an array. The only clean why I see for doing this is by breaking the binary compatibility, then one could also rename "array_type_hint" and change it's type from zend_bool to a better suited type. Independently from this compatibility issue I'd vote -1 for 5.3. Yes 5.3 took loooong and we should, in my opinion, try to be faster with the next "feature release" instead of changing syntax and adding other big features in _bugfix_ releases. I know it is bad to wait long till new features become available (btw. that's one of the reasons why 5.3 took so long - "let's add this feature else we have to wait so long till we get the next major version") but adding features and changing syntax is a pain for users and at least one of the reasons why distributors won't update the PHP versions they are offering (What's the current PHP version in RedHat, again? - Yes, I know people should built PHP themselves but still...) A thing I wish for sometime is a change to our release model but never sat really down to do the research and write a good proposal. The basic concept would be to have a pre announced release date (maybe +/- a few days) and therefore a "last integration date" a few weeks/months beforehand. Ideally the release and integration date for the next version would be set before the integration date for the current tree is reached. After the integration day only be bug fixes should be allowed, no new features at all. By such a model people can plan and if a feature doesn't make it into a release it's not rejected for an unforeseeable future. Similar models, in different flavors, are used by at least PostgreSQL, Ubuntu, OpenSolaris and quite a few more ... but well, that's off-topic for this thread and I wanted to do some more research with other projects before proposing such a thing .... johannes