Re: The past of PHP - object model - oops

From: Date: Wed, 29 Aug 2001 23:49:39 +0000
Subject: Re: The past of PHP - object model - oops
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-65130@lists.php.net to get a copy of this message
For the definition of embarassment, see previous post. replace $cs with $as and the demo starts to work. (one of ) The problem(s) with my code was similar. One must always watch for the stupid factor! Chagrined, Greg -- The Chiara String Quartet http://www.chiaraquartet.net "Greg Beaver" <beavergr@pilot.msu.edu> wrote in message news:20010829234427.20471.qmail@pb1.pair.com... > Oh God, please hurry and release a stable PHP with Zend 2.0!! I &$hate > &$this &$bs &$and &$can't get it to work &$at &$all! > > Thank you, > Greg > > P.S. If any one of you has figured out how to do this: > <?php > class a > { > var $parent; > function a(&$b) > { > $this->parent = &$b; > } > } > > class b > { > var $as; > var $parent; > function b(&$c) > { > $this->parent = &$c; > for($i=0;$i<5;$i++) > { > $this->as[$i] = &new a($this); > } > } > } > > class c > { > var $bs; > var $test; > function c() > { > for($i=0;$i<5;$i++) > { > $this->bs[$i] = &new b($this); > } > } > } > $foo = &new c(); > $foo->test = 1; > $foo->bs[3]->cs[2]->parent->parent->test = 5; > print $foo->test."<br>"; > print $foo->bs[3]->cs[2]->parent->parent->test; > // output: > // 1 > // 5 > // and should be: > // 5 > // 5 > ?> > > let me know *please*. I have 3 objects, form, table, and field for database > abstraction that need this linking. > -- > The Chiara String Quartet > http://www.chiaraquartet.net > > > "Zeev Suraski" <zeev@zend.com> wrote in message > news:5.1.0.14.2.20010829144246.03ae7618@localhost... > > If I didn't know you're not working for Zend, I'd suspect that was a > > prepared-question :) > > > > http://www.zend.com/engine2/ZendEngine-2.0.pdf > > > > At 11:26 29-08-01, Geoff Caplan wrote: > > >Hi folks > > > > > >While we are on the subject of strategic issues for PHP, a quick question > on > > >the OOP functionality. > > > > > >As many on this list will know, there is a peculiarity with the PHP > object > > >model - in many situations it creates a copy of an instance when you > would > > >expect a reference. This means that you have to constantly remember to > > >create references with &, adding an extra source of hard-to-find bugs. > > > > > >Are there any plans to sort this out? It rather disfigures the language. > > > > > >Yes, I know PHP was conceived as a functional language, but a high > > >percentage of the more sophisticated applications make use of its object > > >functionality - you just have to look at the script download sites to see > > >that this is true. Both Perl and C/C++ are examples of successful hybrid > > >languages. With just a little extra work, PHP could join this list... > > > > > >Geoff Caplan > > > > > > > > > > > >-- > > >PHP General Mailing List (http://www.php.net/) > > >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > >For additional commands, e-mail: php-general-help@lists.php.net > > >To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > -- > > Zeev Suraski <zeev@zend.com> > > CTO & co-founder, Zend Technologies Ltd. > > http://www.zend.com/ > > > >

« previous php.general (#65130) next »