Re: Assign array with __get

From: Date: Thu, 25 Mar 2010 23:26:27 +0000
Subject: Re: Assign array with __get
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-47631@lists.php.net to get a copy of this message
Hi,

On 3/22/2010 21:49, Stanislav Malyshev wrote:
Hi!
I guess what Mathieu is trying to say is that this: ...is inconsistent with this:
This is because you're doing it wrong. If you intend to modify the property, return it by-ref. Saying the magic "consistency" word doesn't change that.
Now, I'm not really sure this is that bad, as there may be use cases where one would like to return different values every time __get is called. And, as I wrote in a previous email, there are ways to work around this inconsistency by using return by reference, so everybody can be happy. I think.
It's not "the way around this inconsistency" - it's how it is supposed to work.
So, what's the reasoning behind this design decision? Why is it supposed to work like this and not the other way around? -- Ionut G. Stan I'm under construction | http://blog.igstan.ro/

Thread (25 messages)

« previous php.internals (#47631) next »