Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75434 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95550 invoked from network); 13 Jul 2014 18:21:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2014 18:21:18 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.207 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.207 imap2-2.ox.privateemail.com Received: from [192.64.116.207] ([192.64.116.207:33387] helo=imap2-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 30/8F-16748-D1EC2C35 for ; Sun, 13 Jul 2014 14:21:18 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id DBD9F8C0075; Sun, 13 Jul 2014 14:21:14 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Q6l_JgtzbrtL; Sun, 13 Jul 2014 14:21:14 -0400 (EDT) Received: from [192.168.0.15] (unknown [90.210.122.167]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id CA4868C007B; Sun, 13 Jul 2014 14:21:13 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: <53C2C84A.6060308@garfieldtech.com> Date: Sun, 13 Jul 2014 19:21:09 +0100 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <49C63232-AB78-4B2C-A3E4-B21748D5D489@ajf.me> References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <027E65EF-C4FC-474C-92BB-D99EFADDEEED@ajf.me> <53C29EE4.3090808@gmail.com> <63e5b1c38d6e0c5111987e78d9b59be3@mail.gmail.com> <53C2AF35.40003@gmail.com> <93bb0c689ccca03a0af46c51abf0e11f@mail.gmail.com> <53C2C84A.6060308@garfieldtech.com> To: Larry Garfield X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) From: ajf@ajf.me (Andrea Faulds) On 13 Jul 2014, at 18:56, Larry Garfield wrote: > We can discuss when the E_* should be emitted separately from what the = cast result is. Is there any actual controversy over what the *result* of casts should = be. This RFC just has the normal casting result. Is anyone really in = disagreement there? > As long as it's an error of some kind it may be OK, but perhaps we = want to leave array as is (strict behavior) rather than changing it to = the primitive logic (cast behaviour)? I think the discussion about how arrays should be casted too for = consistency is a bit silly. What makes sense for non-scalar types = (strict hinting) may not work so well for scalar types; casting to array = is rarely useful, while casting to the scalar types is readily. Also, = frankly, function foobar((int) $a, array $b) is inconsistent and ugly. Note too that the non-scalar types, while they can be casted from, can=92t= always be casted to. You can cast to an object, but only StdClass, and = you can=92t cast to resource at all. I really don=92t think there=92s anything wrong with having one system = for the scalar types and one for the non-scalar types since they=92re so = different. -- Andrea Faulds http://ajf.me/