Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75429 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84257 invoked from network); 13 Jul 2014 16:31:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2014 16:31:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=jocelyn.fournier@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jocelyn.fournier@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.176 as permitted sender) X-PHP-List-Original-Sender: jocelyn.fournier@gmail.com X-Host-Fingerprint: 209.85.212.176 mail-wi0-f176.google.com Received: from [209.85.212.176] ([209.85.212.176:61649] helo=mail-wi0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2D/BD-16748-664B2C35 for ; Sun, 13 Jul 2014 12:31:34 -0400 Received: by mail-wi0-f176.google.com with SMTP id bs8so1438035wib.15 for ; Sun, 13 Jul 2014 09:31:31 -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:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=wMmW697C13pqTTR5bUJ0CCov3HhXUEcgT5l8RnKXxQo=; b=ns8+ZzIX2LyRy1nvSao55nUp160O05Q1mnS5WqTVVTvSBDPUAdbr90oofaXQw0SdxI CSHQRK0dNq9wLQsqvxp8yBqfHvnTYicehq6Dq49ISDwcufr5d6C3zbhA5+TRrfsG5ZIW 7dwHx+eUOIwTeuJo+BEgMw+TGcAMT2FTlMSRAhMDh8O5KEeaReXfzqtBaziEfOWu0ge5 we1/xtHXBgA6lTAFMNcnodZgdmalIa9cj/JqIQxGHv+ugnNROKUzr4yYnYETzFFqA8Fu fHfZt1T0oLuHBtqG1ozfBGHjcx+5u8nHUctC60R5kFQcmegv7d0AAzsGKV6d14VUyYOb UVQQ== X-Received: by 10.195.17.164 with SMTP id gf4mr12991046wjd.45.1405269091896; Sun, 13 Jul 2014 09:31:31 -0700 (PDT) Received: from MacBook-Pro-de-jocelyn-fournier.local (ven06-1-82-234-156-61.fbx.proxad.net. [82.234.156.61]) by mx.google.com with ESMTPSA id wv8sm19533742wjb.1.2014.07.13.09.31.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 13 Jul 2014 09:31:31 -0700 (PDT) Message-ID: <53C2B461.3050902@gmail.com> Date: Sun, 13 Jul 2014 18:31:29 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Rowan Collins CC: internals@lists.php.net References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <027E65EF-C4FC-474C-92BB-D99EFADDEEED@ajf.me> <53C29EE4.3090808@gmail.com> <53C2A2F7.1000806@gmail.com> <53C2A753.2060001@gmail.com> <53C2AAF7.3060504@gmail.com> <53C2AF1D.9070801@gmail.com> <53C2B092.6010908@gmail.com> In-Reply-To: <53C2B092.6010908@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) From: jocelyn.fournier@gmail.com (Jocelyn Fournier) Le 13/07/2014 18:15, Rowan Collins a écrit : > On 13/07/2014 17:09, Jocelyn Fournier wrote: >> If "type hint" is doing exactly the same than explicit cast, it should >> not fail on wants_array('abc'), but give a warning about the implicit >> cast conversion. > > Agreed, but that's a very big "if", and is not what this RFC is > proposing at all. Nor could it cleanly use the current syntax, since > function foo(array $foo) is already valid, and does not perform such a > cast. I agree if we cast, the current "array" behaviour needs to be changed. And if we don't change this behaviour, it would be logical the "type hint" correspond to a strict check for all the type used (there's no reason why array should be an exception). > If you haven't already, please do read Nikita's article which has been > linked several times in this thread, which discusses the different > options. This proposal is closer to "strict weak type hinting" than > "casting weak type hinting"; it differs in *performing* a non-lossy > cast, rather than just asserting the *possibility* of one. I do, but I just voice that as a PHP developer I don't like this approach much, and I prefer the approach of casting + warning as a good compromise :) Jocelyn