Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84818 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64836 invoked from network); 15 Mar 2015 10:41:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Mar 2015 10:41:46 -0000 X-Host-Fingerprint: 93.205.247.108 p5DCDF76C.dip0.t-ipconnect.de Received: from [93.205.247.108] ([93.205.247.108:8531] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A6/E5-29489-6E165055 for ; Sun, 15 Mar 2015 05:41:43 -0500 Message-ID: To: internals@lists.php.net Date: Sun, 15 Mar 2015 11:41:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 References: <6D.2C.32765.10EC0055@pb1.pair.com> <5500D967.5040800@gmail.com> <13.69.64353.73451055@pb1.pair.com> <5501876C.3020107@gmail.com> <3D.85.42021.3E7A1055@pb1.pair.com> <5501B77D.5010800@gmail.com> <85.D1.24603.247C1055@pb1.pair.com> <5501D328.9040800@gmail.com> <98.26.24603.C9DE1055@pb1.pair.com> <5501F823.3060805@gmail.com> <55028793.5040606@googlemail.com> <04.FE.24603.D5CB2055@pb1.pair.com> <5503D9E8.1090008@googlemail.com> <57.60.52108.BE854055@pb1.pair.com> <5504712D.4010103@googlemail.com> <55049B17.2060000@deroetzi.de> <550558AB.9010402@googlemail.com> In-Reply-To: <550558AB.9010402@googlemail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Posted-By: 93.205.247.108 Subject: Re: [PHP-DEV] static constructor From: mail@deroetzi.de (Johannes Ott) Am 15.03.2015 um 11:02 schrieb Crypto Compress: > >> I think I now get the misunderstanding I had on your destructor question > > Sorry for confusion. My points are agnostic about implementation details > and concrete code. It's up to ppl to use this feature as they like. > Okay get your point, but as already discussed several times, the rfc should not be declined for the reason a ppl, who doesn't understand when to use static context or when not to use at all, can do crucial things. Because he although can do without the static constructor. For a horiffic example: class Example { private static $handler; public function open() { self::$handler = fopen('example.txt'); } ... } Example::open(); Indeed I have the opinion some beginner who is doing such horiffic code maybe think more about what he is doing and especially about the side effects inside a so called "magic" method, then outside. > - first point is a logical conclusion: If there is a cctor, there should > be a cdtor. Okay the logical conclusion I can take in count. But doing 15 years of OOP-programming now, I never had the need to have a cdtor, for a "valid" usage of static context. And still after I have seen your examples, which should all be done, as I explained, with instances instead of direct static binding, I don't see the use case for a cdtor. > - second point is about implicit order: Shutdown process will free in > reversed creation order. Classes don't have guaranteed creation order. > But I hope shutdown process of PHP is as intelligent not do unload a class which is needed in another class before this class?! Regards, -- DerOetzi