Re: Allow arbitrary expressions when using instanceof operator
| From: | Daniel Ribeiro | Date: | Thu, 06 Nov 2014 07:42:42 +0000 |
| Subject: | Re: Allow arbitrary expressions when using instanceof operator | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78788@lists.php.net to get a copy of this message | ||
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 <drgomesp@gmail.com> 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
>