Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75482 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21008 invoked from network); 14 Jul 2014 16:16:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jul 2014 16:16:05 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.170 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.170 mail-we0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:50789] helo=mail-we0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C4/46-25444-44204C35 for ; Mon, 14 Jul 2014 12:16:04 -0400 Received: by mail-we0-f170.google.com with SMTP id w62so4063195wes.1 for ; Mon, 14 Jul 2014 09:16:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=MUVZQ2cuTdg/LlLMV0B61TXmKRlxoCNCHa7cj1DgllU=; b=ObrO7VJ/6wMHooBPUGiorn/AdAKFterphJ+vrHWu9Y4lVbPCT2oRpffcD+CzF0QxGz 3ja2Y9y2hgqSfUTrYE/YOd3tMXbAKrsZYBw4+cMdH66KkIqkYiBG8bjmH3fPc6rZ25Z4 thn/bH43lw0pPZvag20IlHLiL+Hem+TrnnwmxEcbp57EWE4aCgBTkw19UDfK4FJAn+vy aNuHKlI7NG21d7AoLFZakX/NP9IOdTx/BDxuoMYee3ar/08WRKRUZo8/nKGOr+MnY/tQ 0vPAX5HsHIzjwLP1ZneQPpo3WklmvWhh39aumu2vA8Hlmb8LaeajMa6Dt2XsWGzF+ZuU NA8g== X-Received: by 10.180.20.206 with SMTP id p14mr25766661wie.26.1405354561089; Mon, 14 Jul 2014 09:16:01 -0700 (PDT) Received: from [192.168.0.139] ([62.189.198.114]) by mx.google.com with ESMTPSA id fs3sm27502570wic.20.2014.07.14.09.15.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Jul 2014 09:16:00 -0700 (PDT) Message-ID: <53C401CC.6010107@gmail.com> Date: Mon, 14 Jul 2014 17:14:04 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: internals@lists.php.net References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <53C3F70A.7010706@gmail.com> <3aa29e080d70c843713e19a952dfbad6@mail.gmail.com> In-Reply-To: <3aa29e080d70c843713e19a952dfbad6@mail.gmail.com> Content-Type: multipart/alternative; boundary="------------060602060108060008030407" Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) From: rowan.collins@gmail.com (Rowan Collins) --------------060602060108060008030407 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Zeev Suraski wrote (on 14/07/2014): >> -----Original Message----- >> From: Rowan Collins [mailto:rowan.collins@gmail.com] >> Sent: Monday, July 14, 2014 6:28 PM >> To: internals@lists.php.net >> Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) >> >> Derick Rethans wrote (on 14/07/2014): >>> A compromise by adding more inconsistencies. >> The only way of not introducing some inconsistencies (or, to put it > another >> way, new features) is to use strict type hints > Actually there's a pretty simple way that's not strict type hints: > > 5) Add type hints using existing syntax, which are casts; Change casts > (both existing and these new ones) to emit a new E_CAST in case of data > loss or 'bogus' conversions. > > Zeev That's not consistent with current behaviour. This does not perform a cast, it performs strict validation: function foo(array $bar) { /* ... */ } foo('123'); Also, I already mentioned it: > Option 2 (or 3) could also be implemented by making *all* lossy casts > emit some kind of notice. The only *consistent* behaviour is strict validation, period. If you want that, use Hack; if you want some other kind of type hint, it has to introduce something new. --------------060602060108060008030407--