Re: property de-referencing
| From: | Rasmus Schultz | Date: | Wed, 01 May 2013 12:12:13 +0000 |
| Subject: | Re: property de-referencing | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-67243@lists.php.net to get a copy of this message | ||
>
> This won't work, because Task::$task is a protected property
It will work for code that's properly documented with @property annotations..
On Wed, May 1, 2013 at 7:05 AM, Jannik Zschiesche <hello@apfelbox.net>wrote:
> Hi,
>
> Lazare Inepologlou <linepogl@gmail.com>
> Mittwoch, 1. Mai 2013 10:55
> Hello,
>
> 2013/5/1 Stas Malyshev <smalyshev@sugarcrm.com> <smalyshev@sugarcrm.com>
>
>
>
> The result is the same with "new ReplectionMethod('foo','bar')".
> The added
> value is that it can be statically checked.
>
> well... yes and no.
>
> Take the Symfony2 example:
> you want to reference ^$task->task with autocompletion in your IDE?
>
> This won't work, because Task::$task is a protected property. Symfony2
> does the magic for you and automagically accesses the getters and setters..
> This probably won't work with property references, since you can't get the
> getters and setters for it (except relying on the name of the property as
> string and manipulating it).
>
> Soo... I guess, for this feature, to be useful, we need object accessors
> first (which were recently rejected by vote)?
>
>
> Cheers
> Jannik
>
>
> Lazare INEPOLOGLOU
> Ingénieur Logiciel
>
> Stas Malyshev <smalyshev@sugarcrm.com>
> Mittwoch, 1. Mai 2013 01:12
> Hi!
>
>
> PHP has functions that can be result of __call or arbitrary code that
> implements fcall handler in an extension. What would be returned then?
> Lazare Inepologlou <linepogl@gmail.com>
> Mittwoch, 1. Mai 2013 00:20
> 2013/4/30 Rasmus Lerdorf <rasmus@lerdorf.com> <rasmus@lerdorf.com>
>
> In C#, they had the intention to introduce the operator infoof(...) to get
> the reflection, not only of properties, but of virtually everything in the
> language. They abandoned the idea because it is really hard to do that for
> overloaded functions and they did not want to do all that work for a half
> baked feature:
>
>
>
> http://blogs.msdn.com/b/ericlippert/archive/2009/05/21/in-foof-we-trust-a-dialogue.aspx
>
> However, PHP does not have overloaded functions, which makes things
> significantly easier, so maybe it is worth examining the idea.
>
>
> Lazare INEPOLOGLOU
> Ingénieur Logiciel
>
> Rasmus Lerdorf <rasmus@lerdorf.com>
> Dienstag, 30. April 2013 23:00
>
> It is certainly not worth overloading the XOR operator for.
>
> -Rasmus
>
>
> Stas Malyshev <smalyshev@sugarcrm.com>
> Dienstag, 30. April 2013 22:58
> Hi!
>
>
> You probably have use case for that, and it should be pretty easy to
> write a class that does that, but why it should be in the language? It
> certainly doesn't look like something sizeable portion of PHP devs would
> do frequently.
>
>