Re: property de-referencing

From: Date: Wed, 01 May 2013 11:05:41 +0000
Subject: Re: property de-referencing
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi,

Lazare Inepologlou <mailto:[email protected]> Mittwoch, 1. Mai 2013 10:55 Hello, 2013/5/1 Stas Malyshev <[email protected]> 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 <mailto:[email protected]> 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 <mailto:[email protected]> Mittwoch, 1. Mai 2013 00:20 2013/4/30 Rasmus Lerdorf <[email protected]> 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 <mailto:[email protected]> Dienstag, 30. April 2013 23:00 It is certainly not worth overloading the XOR operator for. -Rasmus Stas Malyshev <mailto:[email protected]> 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.


Thread (64 messages)

« previous php.internals (#67242) next »