Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101697 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60375 invoked from network); 26 Jan 2018 15:29:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jan 2018 15:29:34 -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 74.125.82.52 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.52 mail-wm0-f52.google.com Received: from [74.125.82.52] ([74.125.82.52:35758] helo=mail-wm0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E5/04-35287-D594B6A5 for ; Fri, 26 Jan 2018 10:29:33 -0500 Received: by mail-wm0-f52.google.com with SMTP id r78so22005538wme.0 for ; Fri, 26 Jan 2018 07:29:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=YYO4mMaamJfFB65z9usozGV347KAYOhlZdp/wlg1dpI=; b=awNXftuFFgqWkFv15n/dmHITn9SuO9xvyLtGxAJmAFVjjtFvzkBe5O8+sD4IletGpF MVxaCLtV4uYZzmEHeJJuD2KS/maGab1eJqgZlQ8hBhxtPl8PPZNtk+aYwsnm/U6Ysg/i 8HzafvKo3fHLt5lStBnohzvkrhx6jCoHJrfWlIUnrZX+pRmQ6Dx5Q2XJ2FLWSp7ruXRG UcC/vDKr+sApuqXD6AM0HUIymCAySMX92hNavmXnQgdVW/GBpFRDgpzEPmySRBoacjWL QbT/rLfiBLJt3eigXIoWNyMj63aS4PPnZy9R7CWu9ozTHDFwc/pk9wXack2eNNa3itne DMaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=YYO4mMaamJfFB65z9usozGV347KAYOhlZdp/wlg1dpI=; b=i5r7u4m78ri8jYqXblwmtJtZKobeiA+tV+M9JYS3t04v2wZ16H/M4eC/tDhYNEbTWJ MzNIvwYa2YTxBORyjRLcq2SvNwzD4FsfndWieNjBTL+KllrZYTXPB6v2kDInHlHj97CH H3Ioa8pJTj7oWeEQNaKccQLEwGKI7DH2hJHXWCQLK9ESn2YfGHcehAnVs2eZ9BJ9Bzkf mrsKW7W2D8e1QQkMjIezf3mgVSgGfrFEmzM+K4MM680apumYiZIo0tsfBYmsl+VshXva histlhB1F2w51CbWj03KyhEduQGg0gEYFDTpnu+2VcP8a6vkIb41sFRQfVMeuAYdrPih 6R5A== X-Gm-Message-State: AKwxyterCTH4czE55tMB6/f+ab0ceS05L9AIG2qpMqCjIIraysuZf0rP ypKPTTZ+Unx15kRcvtWkRLXtQqBllClRQB/helQm7g== X-Google-Smtp-Source: AH8x224TjiNmPmrsSMnsu+ql/r44uVPmbgcGd+sd7+attjb5/Go7kCIDIxPuZU8OXvBd6xmu/w7bNplCi9WJrNz2nkA= X-Received: by 10.80.181.93 with SMTP id z29mr20298993edd.223.1516980570634; Fri, 26 Jan 2018 07:29:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.222.195 with HTTP; Fri, 26 Jan 2018 07:29:30 -0800 (PST) In-Reply-To: References: <9b12b0e2-185e-86fb-0e0b-c4f24bfbd661@gmail.com> Date: Fri, 26 Jan 2018 15:29:30 +0000 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="f403045c0b460b40630563af90f7" Subject: Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection From: rowan.collins@gmail.com (Rowan Collins) --f403045c0b460b40630563af90f7 Content-Type: text/plain; charset="UTF-8" On 26 January 2018 at 14:20, Michael Morris wrote: > On Thu, Jan 25, 2018 at 11:59 PM, Niklas Keller wrote: > >> >> $b instanceof SomeClass > >> >> > >> >> Returns true if SomeClass can be iterated and contains only strings. > >> >> > >> > > >> > This would block generics with that syntax then. > >> > > >> > >> I don't understand this comment. > >> > > > > You restrict these type parameters to iterators, but generics are useful > > in a lot more places. > > > > iterABLE --- not iterATOR. Two different things. > > [...] > > The similarity of the names is regrettable, but it's already in place and > can't be changed at this point. > I think you misunderstood Niklas's point. Your example showed the syntax "SomeClass" with an iterator/iterable specific meaning, which would mean we couldn't later use this syntax for generics. With generics, "$b instanceof SomeClass" would mean "is the class of $b, or one of its parents or interfaces, a generic template SomeClass specialised on the type string"; that would be incompatible with your proposed meaning of "$b can be iterated and contains only strings". The plain form "iterable" would co-exist fine with generics, and "Iterator" could be kept compatible if a generic interface "Iterator" was added when generics came along, so we wouldn't be tying our hands by adding those. Regards, -- Rowan Collins [IMSoP] --f403045c0b460b40630563af90f7--