Re: Problem with references

From: Date: Fri, 05 Dec 2003 10:57:42 +0000
Subject: Re: Problem with references
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-171964@lists.php.net to get a copy of this message
Sorry if the title implies that I have a problem that needs solving. The title was meant to imply that I think PHP may have a 'problem' (or at least a shortcoming) with references. I am currently in the detailed design phase of a project. There are many possible ways to do things. One of the possible designs relies on object references being returned in a function parameter, it would appear that you can return anything in a function parameter EXCEPT a reference to an object. So I will drop that particular alternative! I was just seeking clarification that this was the case or whether I had just overlooked some function (e.g. dereference($Ref) =& $Object). As for the bizarre function, well that was just an illustration of what I meant. It indicates that I can't just return copies of objects (which would be the default case) because the returned sub-object would not be related to the returned main object. Thanks for the tip about returning arrays. I think that's where the final design lies :) "David Otton" <phpmail@jawbone.freeserve.co.uk> wrote in message news:ve1vsv89has36sdajq3e8f9oaevvuldthc@4ax.com... > On Thu, 4 Dec 2003 09:58:09 -0800, you wrote: > > >David Otton <phpmail@jawbone.freeserve.co.uk> > > on Thursday, December 04, 2003 3:43 AM said: > > > >> function f() > >> { > >> return (array (7, 5)); > >> } > >> > >> list ($a, $b) = f(); > > > >Hey cool! I never knew about that. > > Yeah, compared with returning a pointer to an array of pointers to > structs... well, scripting languages make you lazy :) > > But without some feedback, I have no idea whether it solved his problem or > not :(

« previous php.general (#171964) next »