Re: Can I use Functional Pointer? / Javascript bracelet conflict ?

From: Date: Mon, 15 May 2000 16:23:40 +0000
Subject: Re: Can I use Functional Pointer? / Javascript bracelet conflict ?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-64@lists.php.net to get a copy of this message
> I don't think there will be pointers, > the language has so far been able to avoid them > (which is a good think for a scripting language, IMHO). I would agree to avoiding pointers. But the problem is that PHP copies objects completely instead of the references to them. This is quite unpractical. Some examples. (1) To clean op my code i often make a short-hand for an object further down in the tree. Say: $subobj = $this->obj1->obj3...; Unfortunately this makes a copy, so you will be doing the assignemnts on the copy. (2) I want to pass a reference to an object inside an array and give it to a function. But inside the function you have a (deep) copy of the original object, even if you pass it by reference. (3) A parent child relation. You would like to set the child of a parent object with: $parent->setChild($child); It seems as soon as you assign the $child variable inside the method to the object property an (unnecessary) copy is made. I find this confusing and unpractical. But i am probably missing out on something. Please could someone clarify this. Dirk Soede

« previous php.general (#64) next »