Hello Andi,

  so now we will copy Java behavior? But why then have destructors at all?
But since we have them why not allow visibility with destructors as all the
other languages do which have destructors?

I came accross it when i wanted to force certain destruction ion behavior. I
could define it as protected or private but the visibility was simply ignored.
So i added a short fix for that and found out that the GC causes some trouble
with that, which i solved by the patch applied here earlier.

Anyway if we were to disable visibility for destructors we'd need to do that
in the compiler right where the function gets defined. Only it would be very
strange to have visibility but do not have them always. And also when Java
does not have destructors, why do we have destructors at all? Or isn't that an
argument.

Friday, July 4, 2003, 10:16:11 PM, you wrote:

AG> At 07:29 PM 4/7/2003 +0200, Marcus Börger wrote:
>>AG> I don't like these OO tricks. It makes sense in my opinion not to have
>>AG> access modifiers for destructors. The destructor should be called on 
>>object
>>AG> destruction no matter what.
>>
>>Hm, i think full language support for factories and related patterns are oo
>>tricks that we should provide. At least i *very* much hope we do.

AG> I don't see any correlation between factories and design patterns and 
AG> allowing destructors to have access modifiers. Java doesn't even have 
AG> destructors :)

As i said already i came accross it.
What you could do with it is to control the complete object lifecycle.
And if GC causes a warning/error on an attempt to destruct an instance with
a protected or private destructor it would help for building large scripts or
scripts with long run times where many objects are used. It would help because
just you can be forced to destruct the object in a certain way...one that does
soem other work, too. And not all of these are possible with plain public
destructors.

AG> Anyway, as I mentioned before, destructors shouldn't have access modifiers 
AG> (like methods in interfaces). So what you are saying is that today we can 
AG> make destructors private/protected? If so we need to fix it.

AG> Andi


>>Sometimes it is necessary to explicitly destruct an object and bla bla....
>>Btw. have a look at tests/classes/destructor_and_globals.phpt and make the
>>destuctor protected or private with and without my patch. Beides that the
>>situation is somekind of a more 'funny' problem we should fix it sometime.
>>
>>
>>--
>>Best regards,
>>  Marcus                            mailto:[EMAIL PROTECTED]


farwell,
i'm out for a drink now (which i really need now)
marcus


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to