Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72267 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10199 invoked from network); 5 Feb 2014 12:10:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2014 12:10:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=krebs.seb@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=krebs.seb@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.47 as permitted sender) X-PHP-List-Original-Sender: krebs.seb@gmail.com X-Host-Fingerprint: 209.85.216.47 mail-qa0-f47.google.com Received: from [209.85.216.47] ([209.85.216.47:38378] helo=mail-qa0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6F/55-09402-A1A22F25 for ; Wed, 05 Feb 2014 07:10:03 -0500 Received: by mail-qa0-f47.google.com with SMTP id j5so365602qaq.6 for ; Wed, 05 Feb 2014 04:10:00 -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=Hidacs4CiSuoEupumm2hqivlJ6Bl29htWLJK+XttZkg=; b=MPevxbBVMjaF9AhaxX5YYH0v2IE/2bOoV4h2zvajB+ikeiLf6Uzg3hVjJulZdgHGA7 M1XFdRGM3z2+N3k1qgdYgvqNfZBgX35ow+CuDFNCs9PUJNB730/QqetBNkvz+AC1tDfW 4fpzOWJpVjfCfRVF2lMtQBeHB0sNL4TBvdVha7ZplpQSTKTYnZKRRtXK10LmSrg/pM85 lmNKfrmUTnpC2M/6L99pYcaNm870fyLJ0NoQdkPhAQHS1tLEtnOeMjiFVMzmt8l9oyxd sRmt8qpLr49Q9LivRGnxXjAZPeV2r1WhparSJwP3XQWkNGTDz94xRHkpBddt9KNVNXn2 yu+A== X-Received: by 10.224.70.84 with SMTP id c20mr1816799qaj.48.1391602200201; Wed, 05 Feb 2014 04:10:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.87.151 with HTTP; Wed, 5 Feb 2014 04:09:20 -0800 (PST) In-Reply-To: References: Date: Wed, 5 Feb 2014 13:09:20 +0100 Message-ID: To: Marco Pivetta Cc: Kevin Ingwersen , internals Content-Type: multipart/alternative; boundary=047d7bf164e6cfccb904f1a7a233 Subject: Re: [PHP-DEV] Singletons From: krebs.seb@gmail.com (Sebastian Krebs) --047d7bf164e6cfccb904f1a7a233 Content-Type: text/plain; charset=ISO-8859-1 2014-02-05 Marco Pivetta : > 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 "hackish", by using a static property, initializer 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. > Beside this: Thats how it works in all me known languages. I don't know any language, where a pattern (in any form) is part of the core. > > Cheers, > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > -- github.com/KingCrunch --047d7bf164e6cfccb904f1a7a233--