Kevin Ingwersen wrote (on 05/02/2014):
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
Kind regards, Ingwie
Hi Kevin,
Could you explain what kind of thing you would want that would require changes to the core of the language?
Although there are a few interfaces in the SPL (e.g. SplSubject and SplObserver for implementing the Observer Pattern), such patterns generally exist entirely in user code. A standardised interface could always be discussed in a group such as FIG http://www.php-fig.org/
Are there other languages that implement support for Singletons as a language construct, or advantages other than standardisation in having a core implementation?
Regards,
--
Rowan Collins
[IMSoP]