Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92583 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26153 invoked from network); 20 Apr 2016 22:57:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2016 22:57:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.41 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.41 mail-wm0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:35609] helo=mail-wm0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FE/2A-14036-E6908175 for ; Wed, 20 Apr 2016 18:57:50 -0400 Received: by mail-wm0-f41.google.com with SMTP id e201so67079313wme.0 for ; Wed, 20 Apr 2016 15:57:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=bTc8yascVtMLj0Hr+EW4s7+GQcvFwhzfYMRcVadOH/E=; b=Mg6YSs5Ss3cmTQ0DTJaorz5XZ+jPBvYihIoXrxCTFTeGtQGuf1kwhUwqW0ph1weSjH ea+6w/YVwI/u/KOqPwS3XQWZvYEhbuKwx0swQuBiPPAm7rem8fRnDAfaGBJYbpRpEu/J hscXadoNgMmKX02/Ra+ua4Y6hpHBwWy8Y9cjv9PDECujWeRdaDw1MGYuRwHZylnxElNZ KotWZvP5nthp7kh5qTRuIL0NBHN3kZ50LOWqmkcfvtOimpAe/XYFCuW/dvDoXbd6I8L5 jTQLtf3fnjlU0ehUHadLzHWv5E3zTYiiEDZ7VIMecWWFWJLp7+JpjtQIJ/671qgJw4sq bUHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=bTc8yascVtMLj0Hr+EW4s7+GQcvFwhzfYMRcVadOH/E=; b=OvNgXHAMJsr7w/FAqJWX/ate7ZzYj0TKb0PxlFHEyeWxQEkwVj1+PYKxh6TKa0yDsc 1e/gO8ls7knr2k7VSsz2pd+6jgeRPc5Ex/E6FPQ+JPvdwt5gamSHvmwXbjjG3+DqjN6s d6m2ATiXPi5a2TjpYuZji8r+zxZqEB2qe0+GBtdHaGN9RmyxBrUGUwnUq4R11VWWKG7J QK2hHWDL4C0FxO1AWXdPv6lSZqZQAPbssYeWzdwmo2njAzYaaYFauCN/7W0HV9r90ZsM 8Yozmx96NclaYOOWCHBjh6lo8cluDe1JxQLKYv4uPSFug9VlpFJ/KDBKSGvN7pgOOP6j JgOg== X-Gm-Message-State: AOPr4FVScv3dwp79wWWadtpjoWs+ldDaV7GCAqP7+V+CeJ1xzQmlYYPVlzywRogIE1T0jg== X-Received: by 10.194.111.199 with SMTP id ik7mr12325146wjb.150.1461193067506; Wed, 20 Apr 2016 15:57:47 -0700 (PDT) Received: from [192.168.1.189] ([2.27.88.132]) by smtp.googlemail.com with ESMTPSA id f8sm7782733wjm.13.2016.04.20.15.57.46 for (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Apr 2016 15:57:46 -0700 (PDT) To: internals@lists.php.net References: <3cc8a4c7-2640-11ae-a67b-06f909ac1e27@texthtml.net> <57173859.4080501@rochette.cc> Message-ID: <57180921.8020000@gmail.com> Date: Wed, 20 Apr 2016 23:56:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC:generics] From: rowan.collins@gmail.com (Rowan Collins) On 20/04/2016 22:02, Jesse Schalken wrote: > "instanceof" implies to me that the right hand side is a class/interface > name, since that's what's expected with the "instanceof" operator, rather > than a type. If I can do "Foo>" I would expect to > be able to do "if ($t instanceof array) ...", but I can't. I'm not quite sure what bounds would mean for anything other than classes or interfaces. A generic type that specified that its type parameter must be an int seems to me to be a non-generic type, because nothing other than an int "is int". How is "class Foo { public function __construct(T $arg) { ... } }" different from just saying "class Foo { public function __construct(int $arg) { ... } }"? (Unless there were some kind of overloading, such that you could also have Foo, but please let's not go there...) Note that generic arrays are out of scope of the current RFC anyway, so it's possible that "$t instanceof array" could be added at the same time as "Foo>", presumably with the meaning that "array" would be considered to pass the check. Regards, -- Rowan Collins [IMSoP]