Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78810 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31870 invoked from network); 6 Nov 2014 11:50:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2014 11:50:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.200 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.200 imap1-2.ox.privateemail.com Received: from [192.64.116.200] ([192.64.116.200:55792] helo=imap1-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9F/F2-28384-9606B545 for ; Thu, 06 Nov 2014 06:50:01 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id D165BB0009D; Thu, 6 Nov 2014 06:49:57 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap1.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap1.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id hQqWc-0RARnP; Thu, 6 Nov 2014 06:49:57 -0500 (EST) Received: from oa-res-26-28.wireless.abdn.ac.uk (oa-res-26-28.wireless.abdn.ac.uk [137.50.26.28]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 77DCAB00099; Thu, 6 Nov 2014 06:49:56 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) In-Reply-To: Date: Thu, 6 Nov 2014 11:49:54 +0000 Cc: Stas Malyshev , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <13E1F1B8-D2DB-4BAF-95FD-E9AB7A7D1AA5@ajf.me> References: <545B3900.6070208@sugarcrm.com> <6FB6D82E-CF77-462D-8420-A1E37915EA13@ajf.me> To: Daniel Ribeiro X-Mailer: Apple Mail (2.1990.1) Subject: Re: [PHP-DEV] Allow arbitrary expressions when using instanceof operator From: ajf@ajf.me (Andrea Faulds) > On 6 Nov 2014, at 11:43, Daniel Ribeiro wrote: >=20 > On Thu, Nov 6, 2014 at 3:36 PM, Andrea Faulds wrote: >=20 >> Perhaps, dare I say it, we should merge the constant and class = namespaces >> in PHP7? Those are perhaps the least likely to conflict. It=E2=80=99d = mean we could >> handle instanceof expressions, and we wouldn=E2=80=99t need to use = ::class. >=20 >=20 > Hi Andrea! >=20 > I'm not sure I understand what you mean by "don't need to use = ::class=E2=80=9D. By merging the symbol tables, you could reference classes like constants = (perhaps it=E2=80=99d return some sort of ReflectionClass-like thing?): $x =3D SomeClass; $foo =3D new $x; Currently, because SomeClass above would resolve to a constant, you have = to use the weird pseudo-constant ::class: $x =3D SomeClass::class; It also would mean instanceof could accept arbitrary expressions, as = there=E2=80=99d be no syntactic ambiguity: class Foo {} const Bar =3D =E2=80=98Foo'; $x =3D (new Foo) instanceof Bar; // works (Bar resolves to = =E2=80=98Foo=E2=80=99, valid class name) $x =3D (new Foo) instanceof Foo; // works (Foo is a class) const Foo; // Not allowed, conflicts with class -- Andrea Faulds http://ajf.me/