Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78788 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87195 invoked from network); 6 Nov 2014 07:43:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2014 07:43:07 -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.49 as permitted sender) X-PHP-List-Original-Sender: drgomesp@gmail.com X-Host-Fingerprint: 74.125.82.49 mail-wg0-f49.google.com Received: from [74.125.82.49] ([74.125.82.49:57494] helo=mail-wg0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 21/7A-28384-A862B545 for ; Thu, 06 Nov 2014 02:43:06 -0500 Received: by mail-wg0-f49.google.com with SMTP id x13so483763wgg.36 for ; Wed, 05 Nov 2014 23:43:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=dLm1pAlpvt3uA2h0Mhw+k7xcqn/dD2bGs8s3+l1qp34=; b=cqQeU2IonS0F95Qieap6ZtqgrgPI/cOY68LL8rh8KiFRBylYxsoXtC3zE1c3sYVuOd WTMHfVaTROgOoo5mqHnFwfIIZi6QkDaJZisBBjuB6n5xWgDyvvEytdaEvoQGvrH1liie Iq/i3vt2Q9wwmM6yzawUpJpnY1Bs9lDirDc2oc08+jqtnYZqn8YcXtlJNV6GAs8q3GBT +HOgHpAeGJR7tUnkoc3iRiaphTLpS5PgVRuB0IBNexfc9dXEae4VWeMNbR3dQpDYgGjK ir3GMczNLNHQ8hV6pPgdZrAabaZzkX5c6ucg4gRXYfeTGcqTzzqQwY2tlQi/61LwBJT4 Dx0A== X-Received: by 10.194.92.148 with SMTP id cm20mr1928883wjb.88.1415259782920; Wed, 05 Nov 2014 23:43:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.39.201 with HTTP; Wed, 5 Nov 2014 23:42:42 -0800 (PST) In-Reply-To: References: Date: Thu, 6 Nov 2014 11:42:42 +0400 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=047d7bfd0166a0411905072bd8a1 Subject: Re: Allow arbitrary expressions when using instanceof operator From: drgomesp@gmail.com (Daniel Ribeiro) --047d7bfd0166a0411905072bd8a1 Content-Type: text/plain; charset=UTF-8 Oh, and thanks to @SaraMG for pointing me to the write direction on writing an e-mail to the internals :) Daniel Ribeiro http://danielribeiro.org On Thu, Nov 6, 2014 at 11:41 AM, Daniel Ribeiro wrote: > 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 > --047d7bfd0166a0411905072bd8a1--