Re: Singletons
| From: | Marco Pivetta | Date: | Wed, 05 Feb 2014 10:55:37 +0000 |
| Subject: | Re: Singletons | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-72263@lists.php.net to get a copy of this message | ||
On 5 February 2014 11:19, Kevin Ingwersen <ingwie2000@googlemail.com> 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..
Cheers,
Marco Pivetta
http://twitter.com/Ocramius
http://ocramius.github.com/