Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83410 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57144 invoked from network); 21 Feb 2015 17:54:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2015 17:54:59 -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.192.43 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.192.43 mail-qg0-f43.google.com Received: from [209.85.192.43] ([209.85.192.43:36022] helo=mail-qg0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/CD-08895-276C8E45 for ; Sat, 21 Feb 2015 12:54:58 -0500 Received: by mail-qg0-f43.google.com with SMTP id i50so18916615qgf.2 for ; Sat, 21 Feb 2015 09:54:55 -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=UTCBF9bPYTdqw/MCepJ/7QNvxEJMHdai02Yb3I2eKKM=; b=mFwcwm4PF1qre92mQMN3sd2+6YVbuzw+pOVuZNk2GyhcTAiUF6dnMnLi00Uu1rmfrZ Rovsa6De3AWGmpqzKVqS9jhO5+7hHFNx/CCrNaWVHEDNemPW2ZpY8Pt0BUZRAQYENws+ mdgzjwR3vuOqFYsScH5kHAIsN2GEwQlN6n2nrykC+q+rJzEKSAfOejbf+n74iopRq2LG sAj3ImKq6niVwg7sqt857lhVAubnJdGzKKX/syM7EUBIGFMXmOPJhpYBTD9pKsfSyU5c FfhcfX+FmUEN+K8PNhAqlz9l12Zqll3FLMWN5dpCNBTE2pjYKc6Ww+BW86i2jSBfmI2q wQsA== MIME-Version: 1.0 X-Received: by 10.140.133.69 with SMTP id 66mr7852337qhf.17.1424541295903; Sat, 21 Feb 2015 09:54:55 -0800 (PST) Received: by 10.96.39.195 with HTTP; Sat, 21 Feb 2015 09:54:55 -0800 (PST) In-Reply-To: <1504122f9eb01ea8d37c38d30e4b677d@mail.gmail.com> References: <1504122f9eb01ea8d37c38d30e4b677d@mail.gmail.com> Date: Sat, 21 Feb 2015 09:54:55 -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] [RFC] Coercive Scalar Type Hints From: pierre.php@gmail.com (Pierre Joye) On Sat, Feb 21, 2015 at 9:51 AM, Zeev Suraski wrote: > [Resending with the correct Subject line :)] > > --- > > 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. > > > > The RFC is available here: > > > > wiki.php.net/rfc/coercive_sth > > > > Comments welcome! 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, --=20 Pierre @pierrejoye | http://www.libgd.org