note 50005 deleted from language.oop.newref by nlopess

From: Date: Tue, 15 Feb 2005 11:30:12 +0000
Subject: note 50005 deleted from language.oop.newref by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-85054@lists.php.net to get a copy of this message
Note Submitter: riseofthethorax at earthlink dot net ---- Your examples fail to outline to me why copies are better than references, just in this example it points out to me how bizarre coding processes can shoot you int he foot... You found one small problem with using references, and found some example to exploit this problem so it would be an issue.. I personally don't use globals for anything other than logging errors in modules.. I might also use them for parameters.. But when I have a global to hang other objects off on, I just do global_object->add($my_object); and in the global object I have function add(& $object) { $this->array[$this->counter] = &$object; } This global object is the implementation of a programming construct called a monitor.. Its better than a global because globals have no usage history, and you can embed in the call logging information to track access in case you need to debug some temporal access problems.. So really you just introduced a decision to deprecate something based on your poor programming habits.. Or is there a reason for it?

« previous php.notes (#85054) next »