|
Posted by Matthew Weier O'Phinney on 06/24/05 20:53
* Robert Cummings <robert@interjinn.com> :
> On Fri, 2005-06-24 at 10:02, Jason Barnett wrote:
> > Robert Cummings wrote:
> > ...
> > > There's a difference between a reference to a reference and a copy of a
> > > reference *hehehe*.
> >
> > Now that makes sense. And am I correctly filling in the blanks when I
> > guess that $foo3 = $aObj is merely copying the reference instead of
> > referencing the reference? I probably could have written that more
> > clearly, but I think you get what I'm saying.
>
> Yeah, *grin*. And on that note, there are times when you will actually
> want $foo = &new SomeClass(); versus $foo = new SomeClass(); since
> assigning by reference will break any previous references -- something I
> forgot to mention to Matthew Weier when he challenged the relevance of
> the snippet I sent.
Funny... I just ran into that last night as I was writing some unit
tests for an app that uses PEAR_ErrorStack! I was unsetting the object,
but that only unset the reference to it -- and so the singleton
reference that PEAR_ErrorStack created was still available when I
instantiated a new object -- which meant previous errors were still
present in the object.
So, I stand corrected; I've seen it now!
Good discussion!
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org
Navigation:
[Reply to this message]
|