Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75589 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1110 invoked from network); 16 Jul 2014 12:28:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2014 12:28:10 -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.179 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.220.179 mail-vc0-f179.google.com Received: from [209.85.220.179] ([209.85.220.179:50854] helo=mail-vc0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 77/A0-31820-7DF66C35 for ; Wed, 16 Jul 2014 08:28:09 -0400 Received: by mail-vc0-f179.google.com with SMTP id id10so1449190vcb.10 for ; Wed, 16 Jul 2014 05:28:05 -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:content-type; bh=D/UdQDPdhFi6fRQZTm7+ynMx/w+yG67OxjqQX8uwL28=; b=AzrAastYj40cxAZedLgWUuKq4LNn8afG+6D/XP5smeR9DXFTyqVR+hGl7PemUISKtY GJm5Zaumnr2c4pKh93k+1DehVGDErulk1UkcAUdACmUB2ZeoIjMqRQNfoqGn2kRNLK8D 6xl4fctrEG13Vl2o8i2idXkxRurNFT/JpjqM2Y01KTw0iI3Dr/zTSmOafvjGz8YfLPkY D9ikMEAN6WThD4Fp2O+3pPDneUvUMrarkEAkFo2qDPaO1GOIp1WvCgOxbCwPLo/4beLk wPbErkwdRjvW/2xNpnRwdCeExdA7B3v7tXq/16sMO1tb3S2JWhrDer2LKfds1qTyN5G1 rzuQ== X-Gm-Message-State: ALoCoQmtiEktuTy796mVyjxHwK+qtdhUnCc8weSQs2XRGTaVvdlSu/E9oWtnKLoTpE2PsPafO3rk0P5xydzwSnCXPBKJ4Z38pxr4tG6VGYU0DQ3ws2ghGzD4rFyiNL+89U6OX39/QG7N X-Received: by 10.220.122.132 with SMTP id l4mr7348198vcr.41.1405513685270; Wed, 16 Jul 2014 05:28:05 -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> <53C652FA.6010704@gmail.com> <53C66D6E.9060200@gmail.com> In-Reply-To: <53C66D6E.9060200@gmail.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJuUFVOlGiX172RfpkkW7aXwqSXwwLGIEDMAn0sGnoDLh5SUQGHGGlvAc6JkJwCOz0MXAIckqSUAcstGVQBlZLKHwF5/8irAazNhfwBXcK3bwJy072RmZGJD4A= Date: Wed, 16 Jul 2014 15:28:04 +0300 Message-ID: <60f496756412de6ad97751d91ead5058@mail.gmail.com> To: 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: Rowan Collins [mailto:rowan.collins@gmail.com] > Sent: Wednesday, July 16, 2014 3:18 PM > To: internals@lists.php.net > Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) > > Zeev Suraski wrote (on 16/07/2014): > > Secondly, if you do enable E_CAST - you may have to slightly*modify* > > your understanding of implicit casts, but you won't have to learn two > > different sets of rules. New users will see just one consistent set. > > I think I've got a bit lost: I thought you were saying implement the > concept of a > "lossless cast", but only emit a warning, not an error. It's more of a lossy cast, exactly as we have today, that has an (effectively-optional-since-it's-off-by-default) to warn you about loss of data. For the vast majority of users who use the defaults, there'll be nothing new to learn except for the availability of those implicit casts in function signatures. For those who want to take advantage of 'loss protection', they'd have to learn about this extra warning type and clean their code so that it adheres to it. But there too, they'd have consistency, just one set of rules for implicit cast of scalar values across all of PHP. > Wherever and however we use it, we would have to invent a set of rules for > what "lossless cast" means, since we don't currently have one. > > I'm not sure what "two different sets of rules" you think other proposals > would create that this one doesn't. The proposal currently on the table implements two, simultaneously active sets of rules that in the long run everyone will have to be aware of. It has both the lossy and lossless concepts active in the same time, which means everyone will have to become familiar with the lossless rules, whether he's interested in that or not. Zeev