Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83407 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52575 invoked from network); 21 Feb 2015 17:46:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2015 17:46:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.175 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.175 mail-qc0-f175.google.com Received: from [209.85.216.175] ([209.85.216.175:32989] helo=mail-qc0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FC/CC-08895-564C8E45 for ; Sat, 21 Feb 2015 12:46:13 -0500 Received: by qcxm20 with SMTP id m20so5524465qcx.0 for ; Sat, 21 Feb 2015 09:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=aWT+2ehUN0IYei+gXyH7bAIy1xfkdhwnK6ehFbNapL8=; b=zwzKHyYZLBd39hH6XzYEzsmo4mH8HrLp3pcoOTly1ULeruiEyn8k7xSQUzKaE6GIW4 ycWj0OMLDGhaMwxjDa1XWnecRdCJ9XMqPtUTYXA3QpB41x9MzvVyVbocn6UAMCnf+PcV hrdjnBr+PKWoinVLz/FSW9gTVm/Pp9qqEfRRoPQkWq78XuNCYnLDr5KEYPtGyj2G5Z1Q jpcDXST5lrs4sCMuNV4RsHvH5MyeK0iyeVJlI/MmRqn+x4dimbunbmjQIcDhqIW/RD3c F0whVE4KcvJaLVLU6LRY2UK0q5FxmRScnUi993exwnr7p/mgJZ6zaLANSG7elk+aXpxW dY7Q== MIME-Version: 1.0 X-Received: by 10.140.100.169 with SMTP id s38mr5639941qge.96.1424540770643; Sat, 21 Feb 2015 09:46:10 -0800 (PST) Received: by 10.96.39.195 with HTTP; Sat, 21 Feb 2015 09:46:10 -0800 (PST) In-Reply-To: <7ef509ef10bb345c792f9d259c7a3fbb@mail.gmail.com> References: <7ef509ef10bb345c792f9d259c7a3fbb@mail.gmail.com> Date: Sat, 21 Feb 2015 09:46:10 -0800 Message-ID: To: Zeev Suraski Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Coercive Scalar Type Hints RFC From: pierre.php@gmail.com (Pierre Joye) hi, On Sat, Feb 21, 2015 at 9:22 AM, Zeev Suraski wrote: > All, > > > > I=E2=80=99ve been working with Fran=C3=A7ois and several other people fro= m internals@ > and the PHP community to create a single-mode Scalar Type Hints proposal. > > > > I think it=E2=80=99s the RFC is a bit premature and could benefit from a = bit more > time, but given the time pressure, as well as the fact that a not fully > compatible subset of that RFC was published and has people already > discussing it, it made the most sense to publish it sooner rather than > later. This does not provide what I consider as the best compromise. An optional per file/package strict mode and a fully compatible with existing mode. However here are some comments: Integer STH (int): =E2=80=9C42.0=E2=80=9D should not be accepted. This is a float not an integ= er. It introduces edge cases I would rather avoid (precision setting f.e., imagine "42.000001" or "42.0001"?) Boolean STH (bool): this is by far too weak. How strings could be consider as valid, how? "true" > Boolean true? I suppose then "false" will be boolean false? What's is the boolean value of float 0.5? At the very least only integer should be accepted, 0 > false, anything >=3D= 1 true Changes to Internal Functions: I am generally speaking against changing them by default, this is a too big BC break. This RFC is also not complete. A test should be provided to valid the changes against existing applications. I suspect the impact may not be as small as we think. I can be wrong here but tests will tell me how wrong I could be :) And finally, this RFC only proposes one solution, so competitive RFCs are still required to actually represent alternatives. Cheers, Pierre