Hmmm.... I agree about the reassigning of $this, but not the passing of $this by ref.
Example: Class A { public $tableName = 'Forum'; public $childObject; public function __construct() { $this->childObject = new B($this); } } Class B { private $parent; public function __construct(&$parent) { $this->parent = &$parent; } public function get_stuff() { // Generate SQL useing the parents global table name settings etc.... } } On Mon, 3 Oct 2005 15:21:38 +0200 Marcus Boerger <[EMAIL PROTECTED]> wrote: > Hello Derick, > > Monday, October 3, 2005, 3:09:22 PM, you wrote: > > > Hello, > > > Dmitry committed a fix earlier to ignore the & in the statement above. I > > think this is not a good thing to do as it's simply conceptually wrong. > > The first thing is that ignoring syntax without issuing a warning is > > dubious because people might think it does actually work, and secondly > > because I think that the code above is wrong anyway - somewhat in the > > same way that "$this = new foo();" is wrong. > > > There is never any need to assign $this by reference, nor to pass it by > > reference to a function as it's an object anyway, making the references > > pointless - I would even go as far as disallowing passing $this by > > references to a function - where the reference has to be ignored again, > > otherwise it allows you to chantge $this to a different object with: > > > class Foo { > > function byRef(&$f) { > > $f = new Bar(); > > } > > > function modifyThis() { > > $this->byRef($this); > > } > > } > > > I think we should prevent people from writing syntax like this, as it is > > not obvious what is going to happen. This means that we should revert > > Dmitry's patch. > > Same here. > > > Best regards, > Marcus > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php ==================================================================== Richard Mann (Programmer) -= Skynet Internet Services a: 8 Premier Court Boarden Close Moulton Park Northampton NN3 6LF -= t: 0845 1 20 65 90 (General) t: 0845 1 24 44 00 (Sales) f: 0845 1 20 65 91 w: http://www.sky.net.uk/ -= D I S C L A I M E R Statements and opinions expressed in this e-mail may not represent those of the company. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender immediately and delete the material from any computer. ==================================================================== -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php