Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78787 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85750 invoked from network); 6 Nov 2014 07:41:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2014 07:41:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=drgomesp@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=drgomesp@gmail.com; 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: drgomesp@gmail.com X-Host-Fingerprint: 74.125.82.52 mail-wg0-f52.google.com Received: from [74.125.82.52] ([74.125.82.52:34017] helo=mail-wg0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7C/1A-28384-6262B545 for ; Thu, 06 Nov 2014 02:41:27 -0500 Received: by mail-wg0-f52.google.com with SMTP id b13so491617wgh.11 for ; Wed, 05 Nov 2014 23:41:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=4eJ290jiNirev20JxHxaF5DyYliyHO/OlR1m2qOCbxQ=; b=CsBRS7Yo7nxrD1BdRCRYbn3P5REHi72ksWaYeuWNmH62rSitvECbEzV2FcE2J4P22V 9KyHwajytksyyNZyhi+t+o/6idUoFPA3XcoAVSz1EM+Bk4ygGevMSvzdrX+rnaBsQ4U0 R0RSTvLYhezEeAVyjeQVVqiIP2XoZvsDYTnh772sxStaZ1rayswyxAib81aXd2zXYhMR WI7yhUPG4sPydldymQ7ZYbUP/MkU8YnoZBptcm+372HeepDOD9ZZGJhAq3QWTm6iMqi1 BxvsmrW2Ho8Xm9bY/+Mg+/s4Y9xgkHcwF0byl4NJoSXIeryXYNm9IFhj/g/32xnHL5Tk waVQ== X-Received: by 10.180.75.179 with SMTP id d19mr38952816wiw.21.1415259683088; Wed, 05 Nov 2014 23:41:23 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.39.201 with HTTP; Wed, 5 Nov 2014 23:41:02 -0800 (PST) Date: Thu, 6 Nov 2014 11:41:02 +0400 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=f46d04389513acf06e05072bd257 Subject: Allow arbitrary expressions when using instanceof operator From: drgomesp@gmail.com (Daniel Ribeiro) --f46d04389513acf06e05072bd257 Content-Type: text/plain; charset=UTF-8 Good morning, internals! I would like to present to you an idea that I have for a syntax improvement for PHP. The basic idea is to allow arbitrary expressions when using the instanceof operator. Currently, the second operand can only be a constant reference or a string: $foo instanceof stdClass; What I want to implement is the ability to allow arbitrary expressions on the second operand, so instead of having to write something like this: $className = 'stdClass'; $foo instanceof $className; We could write something like this: $foo instanceof ($bar->getClassName()); I've been working with Nikita Nefedov on this improvement, and we managed to reach a very simple way to implement it, and it looks pretty good so far. Currently, I don't have a VCS account, and eventually I want to open a formal RFC for this, but I first wanted to discuss this with you guys to see the impressions on it and suggestions as well. Regarding BC breaks, there would be none from what I can see so far - hopefully someone more experienced will be able to point my any. So, what do you think? Cheers! Daniel Ribeiro http://danielribeiro.org --f46d04389513acf06e05072bd257--