On 23 January 2013 19:53, Sherif Ramadan <theanomaly...@gmail.com> wrote:

>
> They're not shown because they don't exist. Thus no confusion about whether
> this is a property or not. If it's a property we can see it in
> var_dump($obj). If it's magic you can only see it in
> var_dump($obj->property). With accessors you see both, but you are seeing
> (potentially) two different values. For me, that's the "misleading" part.
>
> I agree that there are benefits here, but I can't agree that the benefits
> outweigh the draw backs for me, which are all the added complexity. Like
> Anthony said it's pretty much just coming down to custom scoping
> getters/setters at the end of the day.
>
>
>
Actually, having the properties shown even if virtual allows us to access
them in a reflection-ish manner without doing dangerous assumptions like
"does the setter/getter exist"?

The fact that the property is virtual is very useful, even though in
dumping it doesn't show any value. I don't see any radical difference in
debugging or ease of use in general.
Actually, doing the same things with magic getters/setters would probably
imply having to think more about the trace we want to follow when analyzing
our bugs. It is just a matter of being aware of new setter/getters (that
are anyway in our trace).


Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

Reply via email to