Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82893 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46922 invoked from network); 16 Feb 2015 22:05:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 22:05:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=francois@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=francois@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.27.42.2 as permitted sender) X-PHP-List-Original-Sender: francois@php.net X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Received: from [212.27.42.2] ([212.27.42.2:16143] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5B/61-36518-BB962E45 for ; Mon, 16 Feb 2015 17:05:47 -0500 Received: from moorea (unknown [82.240.16.115]) by smtp2-g21.free.fr (Postfix) with ESMTP id 5AE464B01D8; Mon, 16 Feb 2015 23:05:29 +0100 (CET) Reply-To: To: "'Dmitry Stogov'" Cc: "'Arvids Godjuks'" , "'Jefferson Gonzalez'" , "'Rowan Collins'" , "'PHP internals'" References: <011801d04a07$83ab1c00$8b015400$@php.net> In-Reply-To: Date: Mon, 16 Feb 2015 23:05:42 +0100 Message-ID: <015b01d04a34$b4fc1ac0$1ef45040$@php.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQGD0sLDaA+/0NIeBlQhQC5OtPA/xwFsVMiknYFMRFA= Content-Language: fr X-Antivirus: avast! (VPS 150216-0, 16/02/2015), Outbound message X-Antivirus-Status: Clean Subject: RE: [PHP-DEV] Reviving scalar type hints From: francois@php.net (=?utf-8?Q?Fran=C3=A7ois_Laupretre?=) Hi Dmitry De : Dmitry Stogov [mailto:dmitry@zend.com]=20 > I would propose exactly Andrea's 0.1. > Most people were agree to support weak type hints by default. > This proposal won't prevent feature addition of optional strict type = hints. > All are tired from endless arguing. Yes, but that's not exactly what I had in mind. I thought we could just = use it as a base, and add features that, for any reason, will be much = harder to implement in the future. However, most of the work I want to do deals with ZPP macros, which are = not so complex. And userspace type hints follow ZPP rules, so ZPP = changes will apply to internal and userspace functions automatically. = The first thing to do is restricting authorized parsing conversions (ZPP = *and* zend_parse_parameters must matc here) to get approval from = strict-typing fans (tan(1) and curl use cases must be solved first). = Then, define multi-type conversion rules and implement that in ZPP (just = ZPP, not zend_parse_parameters). Once it is available in ZPP, internal = functions will migrate from Z_PARAM_ZVAL at their own pace but the = mechanism must exist before functions can gradually use it. I would really like to implement multi-type support now. IMO, it is one = of the most useful characteristics I expect from type hinting. = Multi-typed argument are natural in PHP from the beginning and should = have been part of the RFC from its beginning too. If people start = describing multi-type args as 'mixed', which is not the same = information, they won't come back and do the work again with more = precise types, asking whether each 'mixed' is a 'real' mixed or just a = placeholder waiting for us to implement the rest. I am especially = concerned with the fact that a good part of userspace function arguments = will be just impossible to type, except as 'mixed', which is not = accurate in most cases. 3 lines above the argument declaration, a phpdoc = comment says that $arg is 'string|array', but the user cannot transmit = the information to the engine... I know it may be a question of time but = it saddens me. I propose you implement the parser/userspace part (I don't know what = remains to be done) and I write and implement ZPP restrictions and = multi-type support. I'll try to define ZPP restrictions (single type) = tonight. I'll also read the 0.1 RFC again and send comments if I have some. I = already know that I want to add the 'resource' type because Andrea's = argument is fake, IMO (and it would make it the only type without a = hint). >>- We need to define the appropriate extension to Reflection = parameters/return type. That's not complex, but it takes time. > It's a subject for separate more or less obvious RFC. Would feature freeze also apply to such work ? Before I write anything, what do you think of suppressing conversions = to/from IS_NULL in zpp (provided we support multi-typed args, of course = ? Regards Fran=C3=A7ois