Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75484 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24128 invoked from network); 14 Jul 2014 16:27:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jul 2014 16:27:40 -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.220.170 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:61216] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6E/E6-25444-BF404C35 for ; Mon, 14 Jul 2014 12:27:40 -0400 Received: by mail-vc0-f170.google.com with SMTP id lf12so3974404vcb.1 for ; Mon, 14 Jul 2014 09:27:37 -0700 (PDT) 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; bh=yYKXRB9nXMYtT0E9m1s/Qsff58bLvs2MBqgyk0s8k6Y=; b=SQIuJ//F6SiUY/RPOuF44WEVKyulmsuWSnKgf8s/GutgfFQHdF8wnxOOFSLEvykoGC ag5vh01fdqKDQgiRjBtFrk3+BJnZbJ5Syde17oSCRw4cCMC/PaV+LFVq6rUn3EbIQRms QJR3wTMiX93sGaF41le8kev9iqmFXExw/MUDAoODZ6ZWyx579J/W1zqWajOgUyjrskos J7Za/trcIXM/oN4Ai4h3zMROS5jDtBGkFizVfoJV/dKgL6ut4ib52MGmIx/bgQKkd+gq YdQQGphb4Qsyo0jOvAcjfCFMzqQ6tmQ7GyCzdhZtsthz6TCF1lzoWTmuSow48OAgC8MZ Ehwg== X-Gm-Message-State: ALoCoQk7c7Q4Vm7bMQfNDQ7B2fGiVwPlGqjDWcn2bh3hcQ/JegGqGUYFjhbD7gbpq8WhcuX+1JgtNTNkJTnfxZ4cPwSzeeE/sU1xKzRV2eouXbTJo0VIosk0kydlVb2Hq80fJye6+bZT X-Received: by 10.52.253.140 with SMTP id aa12mr14359593vdd.11.1405355257189; Mon, 14 Jul 2014 09:27:37 -0700 (PDT) References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <53C3F70A.7010706@gmail.com> <3aa29e080d70c843713e19a952dfbad6@mail.gmail.com> <3b06c592b0b88bb95d3ae7ea7a93d86f@mail.gmail.com> <6AF150D1-1398-43CA-977A-3CF3D51719F4@ajf.me> In-Reply-To: <6AF150D1-1398-43CA-977A-3CF3D51719F4@ajf.me> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJuUFVOlGiX172RfpkkW7aXwqSXwwHleMkPAd/qfJcBzHP03AGqtGtJAmKS0moBHXfO1gIOC4puAaFwLqSZ7vxPwA== Date: Mon, 14 Jul 2014 19:27:36 +0300 Message-ID: <5b53012f7b5437d85cdf9972194aa34f@mail.gmail.com> To: Andrea Faulds Cc: Rowan Collins , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) From: zeev@zend.com (Zeev Suraski) > -----Original Message----- > From: Andrea Faulds [mailto:ajf@ajf.me] > Sent: Monday, July 14, 2014 7:12 PM > To: Zeev Suraski > Cc: Rowan Collins; internals@lists.php.net > Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) > > > 2. It encourages developers to get the types straight instead of > > relying on implicit casts. > > Your proposal is to just use implicit casts with no real failure cases; isn't that > encouraging developers not to care about using the correct types? Not at all. It encourages them to care about types in the PHP spirit. You want to be more strict? No problem, you have a very easy way to carve out these specific cases by trapping E_CAST. > > 4. It allows people to go extra strict very easily, by turning E_CASE > > into errors. My guesstimate is that the majority of people won't, but > > it'll be possible and easy to do nonetheless. > > I really don't like that idea. If someone writes a function with type hints, > people shouldn't be able to make those type hints go away or become more > or less strict. They should be consistent across environments and contexts. But that's exactly what you've been pushing (catching & ignoring E_RECOVERABLE_ERROR), with two differences: - You'd like it to default to the strict behavior instead of the lax, PHP-like behavior - That behavior will be inconsistent with casting; Those 'similar, but different' are the most annoying kinds of inconsistencies IMHO... I do believe that the vast majority of people would want '32 ' and "42\n" to silently convert to 32/42, and will generally not care much about '32abc' converting to 32 either for the sake of consistency. Zeev