Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83428 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91226 invoked from network); 21 Feb 2015 21:02:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2015 21:02:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.213.178 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.213.178 mail-ig0-f178.google.com Received: from [209.85.213.178] ([209.85.213.178:49409] helo=mail-ig0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E4/64-08895-172F8E45 for ; Sat, 21 Feb 2015 16:02:41 -0500 Received: by mail-ig0-f178.google.com with SMTP id hl2so10574569igb.5 for ; Sat, 21 Feb 2015 13:02:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=Qt6NBNDEFZ2ImCnIGtp2lfRmgizrJr6cs6gE25hqPfI=; b=I+ps9lM+4yjhX0ghjw/MtrJBKRB4VWg0q00aDs/J1TDVKbA/eenjYaFkRt98R8s0aO TOaqxcPOibnf2g3YjTE+O46o+thG1QzMA5+iIBLGg8XRdrA9e3exxK/1TtnaV3RT0tc6 zCpxgUNku03vi6clMUpvsuW4DxGM1uWYvyEZ4/Rv+WhzNd5ApJ/03qFFdU9snAVO6PHD 3+AIZpN+iN6BcgwAtbrK6FvADJbhJ6/5e9QTGsKOlNT/6MXgENiQK0F3JqGFsy9BMbN8 wiTgSfsfWA+PUl5IV5a5tVOjouq4nx8WSnlAKEVscXLzbYv8exFcVCQoQlXqxWmZk+kg yfNw== X-Gm-Message-State: ALoCoQlm5qbhUxNXCdIArPt70Z+b2o82pOifNbtfIGu6T7jCbN3aHhMLtkkGvDV/WrvHqQA4G2vZzv12ElgKjAhrJ6WBSFsxQZvJ3jtsEjY2wCFns6YonXPk7BPnO3t/2CcYBgYeK61V/mh3gnpaGH1Hr8d4S0/hdw== X-Received: by 10.107.47.90 with SMTP id j87mr4930686ioo.33.1424552558698; Sat, 21 Feb 2015 13:02:38 -0800 (PST) References: <7ef509ef10bb345c792f9d259c7a3fbb@mail.gmail.com> In-Reply-To: MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQKcPg+jpyYspJS11b5G1A7RBHpKTgFW66vOAVBxp4MBsMGai5tA8mNw Date: Sat, 21 Feb 2015 23:02:37 +0200 Message-ID: To: =?UTF-8?Q?P=C3=A1draic_Brady?= 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: zeev@zend.com (Zeev Suraski) > -----Original Message----- > From: P=C3=A1draic Brady [mailto:padraic.brady@gmail.com] > Sent: Saturday, February 21, 2015 9:56 PM > To: Zeev Suraski > Cc: Anthony Ferrara; PHP internals > Subject: Re: [PHP-DEV] Coercive Scalar Type Hints RFC > > > The sentence stresses garbage in too much to read as accurate. To clarify= , > there is a) garbage in due to weak coercion and b) a function being calle= d > with a string when the typehint says int. Both are separate concerns > around > error detection. Stricter coercion can enable only one of these two, for > example. That's better than neither, of course! The coercion rules were > stricter than I expected based on previous emails. Stressing one too much > might suggest to a reader that the second concern does not exist. As I told Anthony, based on what I saw on the list, the former appeared to be a much more widely-held concern than the latter. > Other pedantic comment: "numerous" is probably too strong a word there. > The advantages may vary by person, but usually fit within basic > five-finger > math. It would be more important to enumerate them rather than selecting > one as primary. Thanks, changed to 'several'. Double thanks, as I always thought 'Numerous= ' was more or less equivalent to 'Several', and you made me look it up :) > On the RFC rules themselves, a few comments: > > 1. Happy to see leading/trailing spaces excluded. Happy to see you happy! > 2. Rules don't make mention of leading zeroes, e.g. 0003 3. "1E07" might > be > construed as overly generous assuming we are excluding stringy integers > like > hex, oct and binary 4. I'm assuming the stringy ints are rejected? It's up for discussion. I personally don't have very strong feelings on ho= w we deal with these cases, as the main thing I care about is for the common cases to work. That said, if it was entirely up to me, I'd accept "0003" but not "1E07" - as the latter is considered floating point: $x =3D "1e7"; print gettype($x+0); // would print double But if rejecting leading zeros is what's needed to get a lot more people to support it, I can live with that. > 5. Is ".32" coerced to float or only "0.32"? Merely for clarification. With the same disclaimer as the one for the previous answer, I'd go with accepting ".32" in the same way is_numeric() accepts it. > 7. In string to float, only capital E or also small e? I think both, same is_numeric() rationale - same disclaimer. > 8. I'll never stop call them "stringy" ints. I can live with that :) Thanks for the feedback! Zeev