Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87189 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48858 invoked from network); 15 Jul 2015 19:55:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2015 19:55:36 -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 209.85.212.176 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.176 mail-wi0-f176.google.com Received: from [209.85.212.176] ([209.85.212.176:35466] helo=mail-wi0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3F/86-27477-7BAB6A55 for ; Wed, 15 Jul 2015 15:55:35 -0400 Received: by wiga1 with SMTP id a1so9813325wig.0 for ; Wed, 15 Jul 2015 12:55:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type:subject:from:date:to:cc :message-id; bh=fVNwpqenlQNHlf1Wyr41Pm5ogRciLQpaapbAgvBE97M=; b=fb+QB00sD2BLkxYr8yR35PpJaWqv6SZxg4zNVtN9j3bD/lD+WNnpHqXY2VmvRIVvQ+ siLr0H/mc40I821wSoipTzAZ424q9lhZUgt0+FqCh6/1ySk13V4SpyN/HW7QRgdBPkrJ WX5lhOs0ymqR9L4R0ur/a/mK6n1PB6/34b89oPSUK3IjqNdRSPUS7xQiAMIn+uXr9PFN TrW7p9cCf12SSQwwGAf0cuajJYXERdGzAJqRtbHBpQAreCFDtF/ca5cWPZZysX2NJ1CM FeaEBkRXPPa8p3HY23dxyUPUOvZB7vgDxOS3BabvUZbXdFxxDOTzdfARTK9RxydD3Vtd sxjA== X-Received: by 10.194.205.225 with SMTP id lj1mr11430608wjc.138.1436990132027; Wed, 15 Jul 2015 12:55:32 -0700 (PDT) Received: from [192.168.0.2] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by smtp.gmail.com with ESMTPSA id ft5sm1492781wib.4.2015.07.15.12.55.30 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 Jul 2015 12:55:31 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: References: <1436967838.8300.16.camel@kuechenschabe> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Date: Wed, 15 Jul 2015 20:53:23 +0100 To: Levi Morrison ,Julien Pauli CC: PHP Internals Message-ID: <47DA8928-322C-4869-809F-BABDCA20FFB5@gmail.com> Subject: Re: [PHP-DEV] Consolidation of Traversable and array operations From: rowan.collins@gmail.com (Rowan Collins) On 15 July 2015 20:39:05 GMT+01:00, Levi Morrison wrote: >Do note that the union types RFC would also alleviate some of this >pain for user-land functions, since `array | Traversable` would cover >the required access pattern. I think this is a superior approach >myself, but I may be a bit biased as I am authoring that proposal: >https://wiki.php.net/rfc/union_types I like the idea of union types in general, but have always felt that a typehint of Traversable should accept arrays as a matter of course. The only thing such a typehint guarantees is that foreach will work (there are no methods defined that can be called directly), and an array meets that condition. The only difference I can see is in the passing / mutability behaviour of objects vs non-objects. Regards, -- Rowan Collins [IMSoP]