Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108411 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 10324 invoked from network); 6 Feb 2020 13:47:28 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Feb 2020 13:47:28 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 241641804F6 for ; Thu, 6 Feb 2020 04:00:05 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 6 Feb 2020 04:00:04 -0800 (PST) Received: by mail-lf1-f49.google.com with SMTP id v201so3885125lfa.11 for ; Thu, 06 Feb 2020 04:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bL0Nur360GRPK+hVVJs1mj9jxTdCaT3q+7V7kb5Hb+w=; b=ChWAMbIWyCc+dyfFVCLDcSCzgXJDmDsS++SJozEydgk9gq9YioOVjRWAyQ8vWYrGse Db4zQckaABT7fKJpFZSydYAKtTS6IPonIoudtCu+58iJ410xnU9mXME03DojHAynoUOX Tzei8pdKUNegFSqrPzGbFU6JEA8RpSc800oEJEvMBNhmTOHK7tCe9JU3qxEyqhVAtlGS SiOOjtmNup8KMTHNcnNZ0kE8CdssOeSyUn0hA4GndmlXalJAnsYnn9aMhZdMw6UDKxhz R8GvEX8FmofR3I8GNzyiXtK/MFwjMST85ZbyUr9et9zl+DHVVoDcnM9QmgizVXjQ3otn /7uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bL0Nur360GRPK+hVVJs1mj9jxTdCaT3q+7V7kb5Hb+w=; b=m+LEpq+sEhub5BbWE2vkDxVVBeVKVYHSdb9yzRJpYdmfnjTQPJJ8MhL26rc125qxzm v8O/s26+5NNMx5RADBv2b4ZpTVkhoZ/Zb10uhU9d1VpM9XzcAmWVju2OaIGYqgc1qoUy dwuyK0Xgg6oF1j3d+KoOG6x2pEFdb9yVaEcUmVtsdms6D/o9TlH5+XTeAFWRv+AFJ66b T8ZYGIEowDTz+rnVQL6hfm4Pi8vEDNASqgWtYnW3cC4tJVj663Z93jQw0tcPVV2S55s6 CplxRblOUDZhSMgSp9uW60kVjFXeFvG74Jt3W5vuPNOy9n/xbVBZjWgzaWGL0zIHdP/5 +4Aw== X-Gm-Message-State: APjAAAVWaV7H5Rr0KixtTXPsuxR4yDCTzSVAsA2TsCPYmGD9Ztuqm6wm 7vqe9cVxIOozS0Xzvb6yQUuBya7bV3W0EtpMoIc= X-Google-Smtp-Source: APXvYqzTe49r+mHwRF+37PTUqE1r2kXJYXaPKfLZqe++299qnQ8gzeR+8+tNPWELRYZAm9eUVGPotVDTOs5N/nXVprI= X-Received: by 2002:ac2:4884:: with SMTP id x4mr1708425lfc.92.1580990401443; Thu, 06 Feb 2020 04:00:01 -0800 (PST) MIME-Version: 1.0 References: <861afae0-4568-745f-6615-a252067cc506@aimeos.com> <5f5a4ab3-e609-4324-b056-53f782f1a63b@www.fastmail.com> <2f37a761-9a54-b8b6-3bcb-39cf2224c227@aimeos.com> In-Reply-To: <2f37a761-9a54-b8b6-3bcb-39cf2224c227@aimeos.com> Date: Thu, 6 Feb 2020 12:59:45 +0100 Message-ID: To: "Aimeos | Norbert Sendetzky" Cc: Rowan Tommins , PHP Internals Content-Type: multipart/alternative; boundary="000000000000458287059de70339" Subject: Re: [PHP-DEV] Re: [RFC] "arrayable" pseudo type hint From: nikita.ppv@gmail.com (Nikita Popov) --000000000000458287059de70339 Content-Type: text/plain; charset="UTF-8" On Tue, Feb 4, 2020 at 7:40 PM Aimeos | Norbert Sendetzky < norbert@aimeos.com> wrote: > Am 04.02.20 um 19:17 schrieb Rowan Tommins: > > I think Larry's point was that the flexibility of PHP's array type makes > it > > really hard to pin down whether a given object is "array-like" or not, > and > > which attributes a particular function actually cares about. > > What else besides array access, counting and traversing is possible that > may differ from classes that implement those interfaces? > > > A general "intersection type" system might be more useful, because then > you > > could require the parts you specifically needed, such as > > "traversable&ArrayAccess" or "traversable&countable". > > I think that's too complicated and we should make it as easy as possible > for PHP developers. > > Also, there's already an RFC for intersection types but it was never > adopted: https://wiki.php.net/rfc/intersection_types > FWIW, that's an old RFC that predates the current implementation of union types in PHP 8 by a few years... A new proposal for intersection types should stand a better chance now, especially as it can mostly reuse the (relatively involved) technical underpinnings for the union types implementation. Nikita --000000000000458287059de70339--