Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72263 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97649 invoked from network); 5 Feb 2014 10:56:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2014 10:56:02 -0000 Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.177 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 209.85.216.177 mail-qc0-f177.google.com Received: from [209.85.216.177] ([209.85.216.177:36948] helo=mail-qc0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/E3-09402-0C812F25 for ; Wed, 05 Feb 2014 05:56:01 -0500 Received: by mail-qc0-f177.google.com with SMTP id i8so293175qcq.8 for ; Wed, 05 Feb 2014 02:55:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=Y/nknjtV1Jcy3NWNuZCSsgKxLYQp0K8uPyGvYe8HBMs=; b=NJX8dDjyaU5b/RRhwJuuSuY4MvHSc2CIJnFYeLKzD3dQcdApf9SICCOoTS26mZeT66 SGrjRz8a6UkeXjRTRU5In7hxxIbztRBjXtNSvdZpa2Fb4VrImDNLnlcAGceLWknVzBh+ ZA5cU721KE/a1zjtFsx5sj4wm1+eSVTl4euZLKU7mF6KocHQtHlGd38XGJR5e2DTAnOf bjVzjDbeZufOVdmkPs2UTNrmROfNWyLtI4djH5MNnKv9XIP1ENfusNP2ZmoBi4nSCG00 umoweomTGjEBJD166beMY0ji+ug39evwDoW3RTNpJGJZlJ7Uyc2jzX/xGxQSV/+IuW/v CdJg== X-Received: by 10.224.172.133 with SMTP id l5mr1183574qaz.25.1391597757843; Wed, 05 Feb 2014 02:55:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.20.231 with HTTP; Wed, 5 Feb 2014 02:55:37 -0800 (PST) In-Reply-To: References: Date: Wed, 5 Feb 2014 11:55:37 +0100 Message-ID: To: Kevin Ingwersen Cc: internals Content-Type: multipart/alternative; boundary=001a11c22f0606cd6c04f1a69a4b Subject: Re: [PHP-DEV] Singletons From: ocramius@gmail.com (Marco Pivetta) --001a11c22f0606cd6c04f1a69a4b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 5 February 2014 11:19, Kevin Ingwersen wrote= : > Hello. ^^ > > I just wanted to ask, if there is a singleton implementation? The current > one is rather =E2=80=9Ehackish=E2=80=9C, by using a static property, init= ializer and a > function to itneract with it all. Sadly, I can not put a patch together > myself - because I am not good with YACC and Flex yet, or with the php vm= - > but i would have a concept for an implementation o.o > Hi Kevin, I don't think that standardizing a well known anti-pattern in core is a good idea. The current static property approach is quite fine and safe to use (if you really need it, which is "no" in 99.9999% of cases), and not hackish at all= . Cheers, Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --001a11c22f0606cd6c04f1a69a4b--