Re: [PHP4BETA] OO Destructors

From: Date: Tue, 10 Aug 1999 19:33:25 +0000
Subject: Re: [PHP4BETA] OO Destructors
References: 1 2  Groups: php.version4 
Request: Send a blank email to php-version4+get-3311@lists.php.net to get a copy of this message
Andi Gutmans wrote: > > Like Zeev mentioned the only way to make OO destructors really work is to > take the Java approach where you have handlers to an object and the object > holds the reference count. > For example, the following two lines would result in $a being a handle to a > new object of type foo, and then $b would be a reference to the same object > foo. Currently in PHP 3.0 and PHP 4.0 it makes $b be an actual copy of $a. > $a = new foo; > $b = $a; > > This would also mean that when you pass an object by value to a function, > it's not copied as the handler is passed which will point to the original > object being passed. You'd have to copy it explicitly. > > Personally I prefer the handler solution which would allow us to make > destructors but I have a feeling that tons of people would be bitten by > such a big incompatibility with PHP 3.0 which would make it not worth it. > People won't move to PHP 4.0. I might be miscalculating how many ppl this > would really bite but it's kind of scary. What about a compile-time (or better yet, run-time) switch to turn on the "4.0" functionality? - George -- email:dotorg@bangsplat.org;url:www.bangsplat.org;uin:153182;aim:tgd98 GCS/GP/GS/GFA d- s+: a- C++++$ UL++++$ P+++$ L+++$ E- W++>$ N+@ !o K+++ w--- !O M-@ V PS+ PE Y+ PGP t-(+) 5- X++ R-(--) tv+ b+++ DI++ D++ G+ e* h r y++

« previous php.version4 (#3311) next »