Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75605 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44339 invoked from network); 16 Jul 2014 21:10:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2014 21:10:13 -0000 Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.181 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.220.181 mail-vc0-f181.google.com Received: from [209.85.220.181] ([209.85.220.181:47587] helo=mail-vc0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B1/61-37298-43AE6C35 for ; Wed, 16 Jul 2014 17:10:12 -0400 Received: by mail-vc0-f181.google.com with SMTP id lf12so2904589vcb.12 for ; Wed, 16 Jul 2014 14:10:09 -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=rSE70cZDGMqKA6g0J00nHiuzwsEMm/I30USCepjJ7sU=; b=RFXtSJLu/yb45fqZ2qdGwc+wru7HLMxhpMB6wa9+iYnUUFi5pfMlDbsJnT1gOAFYMF iM4a+QfA+tO841CyJGPDrVw/MeBzFY39CctfgEN+5nTviBA2+qPf5HrJWMxQM8O99hTr jxh2d0FPYyatNhpQocQnN7He51iAQeY9t8a6ww4p/+mIJD9r5UQu49JfYyYR5RZddlzG oaU5nW9veelhwbMPNhcPqskAl5/ibmxy1drxiCW1jnmadSqJ5mN6jmLMeyk+lxJZo/QQ W+GjCvWBI5FhBmx1zzV5JzDQ7Q+ip1ex4+iIO4XTa2jc7BIh6nSf8NSRIqCbvPifmxaM vO6Q== X-Gm-Message-State: ALoCoQlBX612ZwADYOTlJKTpk1sHoucKMa97mSYbJ2z3XaDwGmEc5lLArljSjSFCHyksKR7vN1imMszXe0zOFnDXvoY4uG3el1pi3EtCpCMDJl3Gfc8yM958MAg9T5c3TG70bpLKHT1c X-Received: by 10.52.249.83 with SMTP id ys19mr9818107vdc.77.1405545009576; Wed, 16 Jul 2014 14:10:09 -0700 (PDT) References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <16D48604-0C0A-4613-91A4-21392E3A2636@ajf.me> <05CE2216-C5D9-4937-9F2E-AA1407284D9F@ajf.me> <53C460DF.5040304@sugarcrm.com> <53C53A96.2040303@gmail.com> <53C55342.1010207@sugarcrm.com> <53C563B3.6060905@gmail.com> <54536191-1B92-4933-973F-0C8289D13A4C@ajf.me> <00d12255efc53466245b21a83ff7d474@mail.gmail.com> <1CE2ACC0-D6CA-407B-99C7-4914311B733E@ajf.me> <53C6CFB7.8090908@sugarcrm.com> <118BB3D7-BE52-44AB-BD0E-942830D44A2A@ajf.me> <9B7B8559-61FE-493D-BAEE-53E8C84D5E91@ajf.me> In-Reply-To: <9B7B8559-61FE-493D-BAEE-53E8C84D5E91@ajf.me> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJuUFVOlGiX172RfpkkW7aXwqSXwwLGIEDMAn0sGnoDLh5SUQGHGGlvAc6JkJwCOz0MXAIckqSUAcstGVQBlZLKHwF5/8irAjNOBKMBp385lgLwVEHDAe12+6oCvuX74JliSAJA Date: Thu, 17 Jul 2014 00:10:08 +0300 Message-ID: <221d3e5c1be1ee2277e05027912762db@mail.gmail.com> To: Andrea Faulds Cc: Stas Malyshev , Andrey Andreev , 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: Wednesday, July 16, 2014 11:45 PM > To: Zeev Suraski > Cc: Stas Malyshev; Andrey Andreev; Rowan Collins; internals@lists.php.net > Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) > > > On 16 Jul 2014, at 21:43, Zeev Suraski wrote: > > >> anything this RFC permits will > >> be permitted by zpp, it's the reverse that isn't necessarily true. > > > > Right, so it needs to be fixed. It makes no sense to force a new > > agenda on the language that's inconsistent with the rest of the > > language. Align your new feature to the rest of the language, not the other > way around. > > But to do so would be to make the feature less useful, nor satisfy people who > want stricter hinting. Stricter typing does not belong in PHP. If it did, we'd have it in internal functions, implicit casting and the rest of the language in general. We don't. And I insist that much like you said people can catch E_RECOVERABLE_ERROR and turn ignore it, they can do the same with E_CASE - except now they won't *have* to learn about this new behavior unless they explicitly want to. While you think it may not be strict enough for some people, and I think it'd be too strict for others - the consistency argument should make the decision between the two obvious. Also, I tend to agree with Stas that we can consider to do E_RECOVERABLE_ERROR on the obviously 'bogus' conversions - like array or object to int. But E_RECOVERABLE_ERROR on simple data loss is radically inconsistent with the rest of PHP. Sorry, I introduced hinting into PHP; I intentionally did not add typing for scalars as it goes against the fundamentals of the language, and I fought this off back in 2008, 2010 and mildly also in 2012. Call me persistent :) FWIW, I think the distance between where you and I stand is not that big - and if we go in the direction of E_CAST for data loss across the board (any implicit casts, not just in type hints), and E_RECOVERABLE_ERROR for completely broken type conversions - this is a big win for PHP, beyond just type hints. Zeev