Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87190 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51297 invoked from network); 15 Jul 2015 20:19:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2015 20:19:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=kontakt@beberlei.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=kontakt@beberlei.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain beberlei.de from 209.85.212.172 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 209.85.212.172 mail-wi0-f172.google.com Received: from [209.85.212.172] ([209.85.212.172:36510] helo=mail-wi0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E0/F6-27477-C60C6A55 for ; Wed, 15 Jul 2015 16:19:57 -0400 Received: by widjy10 with SMTP id jy10so10290339wid.1 for ; Wed, 15 Jul 2015 13:19:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=P0KIPMAtHMbzdrl+muN65b/x8zINoMivmkzYIc7B5W8=; b=f2Fq3JOkMqynZ06+FAjjRkrGrKqGShwYPAdcfRpEts+4Zur+cHB5y5w2fatZnuthHO 5X+jJa4JHzZsgq6BYUpKfaW0thqj8MRPONnPAWpojP/1eLAeK1ogVYepJ4p68uwbnX74 ulORFfosKuyt5PUgw+QmBeS5T5DLDwHBJSFEHxNRzl++zIbywz6JxPk5221QmCs94vdR atFgJg2wxIfK/ZLX3tRMZFMuazvBbpYzfqNuz5mi9YPwoTFwetsmJG3K4Fuu1/k70IjM xRCIPpmpyoOAwByhW7lC1nGcsS7fsljgAGvXfKqsS72CFRQoGtG9k+Cg44Ak4z8MeMIb No9w== X-Gm-Message-State: ALoCoQmQvgXVgzVGK6E3+XjLgChqwehy/JjkhRks/EUzel6WtWmfqON2RUI9zrjYWTfR2mhq7M/R MIME-Version: 1.0 X-Received: by 10.194.109.36 with SMTP id hp4mr12386224wjb.4.1436991593119; Wed, 15 Jul 2015 13:19:53 -0700 (PDT) Received: by 10.194.90.208 with HTTP; Wed, 15 Jul 2015 13:19:53 -0700 (PDT) X-Originating-IP: [93.129.94.142] In-Reply-To: <47DA8928-322C-4869-809F-BABDCA20FFB5@gmail.com> References: <1436967838.8300.16.camel@kuechenschabe> <47DA8928-322C-4869-809F-BABDCA20FFB5@gmail.com> Date: Wed, 15 Jul 2015 22:19:53 +0200 Message-ID: To: Rowan Collins Cc: Levi Morrison , Julien Pauli , PHP Internals Content-Type: multipart/alternative; boundary=047d7bf10a74741b77051aefad6c Subject: Re: [PHP-DEV] Consolidation of Traversable and array operations From: kontakt@beberlei.de (Benjamin Eberlei) --047d7bf10a74741b77051aefad6c Content-Type: text/plain; charset=UTF-8 On Wed, Jul 15, 2015 at 9:53 PM, Rowan Collins wrote: > 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. > But instanceof and anything related to Reflection or get_class or relevant code will fail on array. > > Regards, > -- > Rowan Collins > [IMSoP] > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --047d7bf10a74741b77051aefad6c--