Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79345 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28731 invoked from network); 1 Dec 2014 16:37:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Dec 2014 16:37:02 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.171 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.171 mail-wi0-f171.google.com Received: from [209.85.212.171] ([209.85.212.171:40843] helo=mail-wi0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/D1-18127-D299C745 for ; Mon, 01 Dec 2014 11:37:02 -0500 Received: by mail-wi0-f171.google.com with SMTP id bs8so25159426wib.16 for ; Mon, 01 Dec 2014 08:36:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=nqJx2sS+iUKQciyDBcu6TWmBhnmfNY29ewIUOLPSvqY=; b=ZS64QHhzupChGQRckmpKSMAXksZPrXwC67H5xl/2gjrvlpbOE+WOwMtxm671Eiu8ht hJVZeTLWbyTG/d9i4HGvBEpP/9whsqwNwDmAW36a825UknXtzlUWhAKSP/QDrXhVsDL6 nMY2T8U3vkad42BrkWLjK6ENUZYgC7CVHPlysPNwS6B1nKRXjR1hOqcge0E6++lVyfix qQ8DlgQdbb0R0+n93PApTXt2+hFodZe+MSfkl8YxbPMOgrlSxx4fMFxemw/b71qwlf7L pdACcFxE7JyxGShZd+KMSmK72+qRXfAu76qE9Tbzy6M1XegETlHRQKnEwaKx6VStHvk/ woHg== X-Received: by 10.180.182.226 with SMTP id eh2mr87296958wic.9.1417451816968; Mon, 01 Dec 2014 08:36:56 -0800 (PST) Received: from [192.168.0.148] ([62.189.198.114]) by mx.google.com with ESMTPSA id ej10sm3434678wib.1.2014.12.01.08.36.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Dec 2014 08:36:56 -0800 (PST) Message-ID: <547C991E.2070700@gmail.com> Date: Mon, 01 Dec 2014 16:36:46 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: internals@lists.php.net References: <003c01d00d6e$f4fd77c0$def86740$@tutteli.ch> <868FD3D8-4E80-46F4-872A-125D3FD8F40D@ajf.me> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Static classes (Was Abstract final classes) From: rowan.collins@gmail.com (Rowan Collins) guilhermeblanco@gmail.com wrote on 01/12/2014 15:27: > (1) Function/Namespaced function autoloading > (2) State encapsulation > (3) Function scoping I would add (4) static polymorphism, which Late Static Binding explicitly supports. > But PHP is not one of these dogmatic “everything must be a class” languages: it has true global functions which can be namespaced. By the same token, PHP is not one of those dogmatic languages which says that every class must have at least one instance. There may be advantages to giving your Factory class a constructor, but there is nothing in the language itself to stop you making it entirely out of static methods, and even sub-classing it from an abstract base using LSB. The only thing missing is a standardised, enforced, annotation on the class to declare that you are using this ability and instances will never be created. Regards, -- Rowan Collins [IMSoP]