> php6 will include static late binding

Great. Love the other new features, especially namespaces.

> - until then you have 2 choices,
> create a hack (see below) or stick redundant code into each class you
> want to be a singleton.

The hack doesn't work (See below). Guess we are left with copy-paste
thing :-/ Though i wonder if there are any other hacks using some sort
of classkit/other class manipulation functions?

>     public static function GetInstance()
>     {
>         if (!isset(self::$instance)) {
>                 if (!isset(self::$class)) {

Isn't that self::$class the same "late static binding" thing? :-) As i
get it, at this point from Singleton::GetInstance() you can't get the
static $class member of Test class.

Reply via email to