Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79342 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22454 invoked from network); 1 Dec 2014 15:33:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Dec 2014 15:33:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.200 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.200 imap1-2.ox.privateemail.com Received: from [192.64.116.200] ([192.64.116.200:55317] helo=imap1-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D0/C0-18127-C2A8C745 for ; Mon, 01 Dec 2014 10:33:02 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 284DAB00093; Mon, 1 Dec 2014 10:32:57 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap1.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap1.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id NE1guBzgumuE; Mon, 1 Dec 2014 10:32:56 -0500 (EST) Received: from oa-res-27-210.wireless.abdn.ac.uk (oa-res-27-210.wireless.abdn.ac.uk [137.50.27.210]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 0801CB0008F; Mon, 1 Dec 2014 10:32:55 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) In-Reply-To: Date: Mon, 1 Dec 2014 15:32:53 +0000 Cc: Robert Stoll , internals Content-Transfer-Encoding: quoted-printable Message-ID: <01B00E9F-1066-4AAB-A798-B07811FC46FB@ajf.me> References: <003c01d00d6e$f4fd77c0$def86740$@tutteli.ch> <868FD3D8-4E80-46F4-872A-125D3FD8F40D@ajf.me> To: "guilhermeblanco@gmail.com" X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] [RFC] Static classes (Was Abstract final classes) From: ajf@ajf.me (Andrea Faulds) Hi! > On 1 Dec 2014, at 15:27, guilhermeblanco@gmail.com wrote: >=20 > Hi Andrea, >=20 > Thanks a lot for putting efforts thinking through this problem. > Indeed we have 3 problems that leads to "static classes". You detailed = 2 of them. > The third is around encapsulation. I may want functions that are = reused by other functions at the namespace level, but that shouldn't be = used outside of it. By purely supporting (1), you still didn't address = this issue. That would be easily addressed by having private static = functions inside of the static class. Hmm. Well, having functions not to be used outside of the namespace/file = isn=E2=80=99t a problem unique to classes. That would be useful for = people writing normal functions. Having something like static functions = would be great. > So, as you walk through your options, didn't it feel wrong to you? = Static classes are an easy addiction to the language and would have a = negligent performance impact, since it just adds 2 conditions in zend_vm = and zend_api. Yes, they=E2=80=99re a simple addition, but I still think they=E2=80=99re = the wrong solution to the problem. We shouldn=E2=80=99t force people to = use classes for simple collections of functions. People have wanted = function autoloading for years. I say it=E2=80=99s high time we add = that. Thanks! -- Andrea Faulds http://ajf.me/