Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108400 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 97073 invoked from network); 4 Feb 2020 20:27:49 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Feb 2020 20:27:49 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4F59C18054B for ; Tue, 4 Feb 2020 10:40:03 -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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS34788 85.13.163.0/24 X-Spam-Virus: No X-Envelope-From: Received: from dd46610.kasserver.com (dd46610.kasserver.com [85.13.163.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 4 Feb 2020 10:40:02 -0800 (PST) Received: from [192.168.178.23] (x4d01e038.dyn.telefonica.de [77.1.224.56]) by dd46610.kasserver.com (Postfix) with ESMTPSA id 7DE0243401DD; Tue, 4 Feb 2020 19:40:01 +0100 (CET) To: Rowan Tommins , PHP Internals References: <861afae0-4568-745f-6615-a252067cc506@aimeos.com> <5f5a4ab3-e609-4324-b056-53f782f1a63b@www.fastmail.com> Organization: Aimeos GmbH Message-ID: <2f37a761-9a54-b8b6-3bcb-39cf2224c227@aimeos.com> Date: Tue, 4 Feb 2020 19:40:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: [RFC] "arrayable" pseudo type hint From: norbert@aimeos.com (Aimeos | Norbert Sendetzky) 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