Re: [Zend Engine 2] RSHUTOWN and destructors
| From: | Derick Rethans | Date: | Sun, 20 Jul 2003 10:03:43 +0000 |
| Subject: | Re: [Zend Engine 2] RSHUTOWN and destructors | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-3497@lists.php.net to get a copy of this message | ||
On Sun, 20 Jul 2003, Zeev Suraski wrote:
> All in all, the destructor functionality is *extremely* fragile - to the
> degree that in many points in time we thought about removing it (you can
> look up the CVS archives to see just how many fixes it required so far -
> plenty). Preventing access to resources may be something that we'd just
> have to live with.
What is the point of having destructors then? I did a little quiz on IRC
(yes, I know that that is not our typical userbase) and all of them
mentioned that they wanted to use destructors to: "wrap up files",
"commit a transaction", "do something with an open file", "really make
sure my files are consistent". I am wondering what other use there is
for constructors. Perhaps we should ditch them like namespaces because
we can not come to a good implementation? I don't think that should be
done, as destructors *can* be useful. Besides that I think it's totally
uninituitive that:
$obj = NULL;
?>
works and that the destructor than can access any resource it wants, but
that:
?>
doesn't work (because the destructor is called from request_shutdown).
I'm pretty sure that there is some way to get this working in a decent
way... which might perhaps not be the nicest solution.
regards,
Derick
--
-------------------------------------------------------------------------
Derick Rethans http://derickrethans.nl/
JDI Media Solutions http://www.jdimedia.nl/
International PHP Magazine http://www.php-mag.net/
-------------------------------------------------------------------------