Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75501 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53059 invoked from network); 14 Jul 2014 17:52:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jul 2014 17:52:39 -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.172 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.220.172 mail-vc0-f172.google.com Received: from [209.85.220.172] ([209.85.220.172:39729] helo=mail-vc0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4F/A1-45205-6E814C35 for ; Mon, 14 Jul 2014 13:52:39 -0400 Received: by mail-vc0-f172.google.com with SMTP id hq11so6965165vcb.3 for ; Mon, 14 Jul 2014 10:52:35 -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=gk28c5bRi/2K/ZCvyGAMMH0VWa/Se2oxyDRkIL87iKQ=; b=nDTZ08UsmKBKu6xtEeN5+jKyfLLMLiBYaULiPvGsny2DYrRpEqumTTgq+0A3ESJwUd Xdu55ZhSbtkjTV6la0nh3LZInKvkWon9ptOAybFR9m74byV8csso4dRryzfWDa7jKI7e TrZzwAkYTsWPl8rfB5dTwSs88UyTE0YbDAhxK7yzpDvnm6vHkzhH1iZmD84T06AcCs9N +qstwjZ3TBz4aMgm+Glg+xlkCvhOc9+Y8q4B8+i/L/IRNmbL1LHXqforLp8VFJRaLDkY eJiLWBsk9RZrPS5bbkwUMW3Y234u1FpuRZ1+RFqWi1TWttDNP380jS2+o0W69tSLtSLK 2vmg== X-Gm-Message-State: ALoCoQlo2ZHVFIs9pv1Nb5iz31/zzcpyfnaMmjFce177jyrnc9zR4K9ilUOIjyrXsaqImswIcGviKhjYD3szXHYvIS67YzsVhmNN5LleCgfHZOjkB0L0WmNcfmdzAoJ6FLMkwBv/Io22 X-Received: by 10.221.69.8 with SMTP id ya8mr1417552vcb.39.1405360355747; Mon, 14 Jul 2014 10:52:35 -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> <5b53012f7b5437d85cdf9972194aa34f@mail.gmail.com> <53C408EC.7080104@gmail.com> <5f491f470e902489f036102ae0f437f8@mail.gmail.com> <53C41244.5010505@gmail.com> In-Reply-To: <53C41244.5010505@gmail.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJuUFVOlGiX172RfpkkW7aXwqSXwwHleMkPAd/qfJcBzHP03AGqtGtJAmKS0moBHXfO1gIOC4puAaFwLqQB3IH0cgJS+6QEAQ6G0gACRy0FgZmy681Q Date: Mon, 14 Jul 2014 20:52:34 +0300 Message-ID: <8177fae7c5a1a21ab2bc2b98d7e29d17@mail.gmail.com> To: Rowan Collins Cc: 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: Monday, July 14, 2014 8:24 PM > To: internals@lists.php.net > Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) > > Zeev Suraski wrote (on 14/07/2014): > > I'd say absolutely yes, if they're PHP developers that's exactly what > > they'd expect. After all, if you use 'hello' today in any integer > > context in PHP, explicit or implicit, that's exactly how it will > > behavior across the language. > > And yet if you use it as a parameter to a type hinted function, it will > produce > an error. Type hints were first and foremost introduced for object oriented safety, as a part of the major OO model shift Andi and I pushed for in PHP 5.0. What you may be alluding to - type hints for arrays and objects - were added at later time and introduced that small inconsistency you're talking about. Still, type juggling for scalars has been the fundamental nature of PHP since the get go; Type jugging for arrays/objects was always more of an edge case and perhaps even a misfeature. > You can be consistent with casts, or consistent with existing type hints, > but not > both. Type looseness defines PHP. Type hints do not. Zeev