final public static function autoloadRegister()
    {
        // spl_autoload_register disables oldschool autoload
        // even if it was added using spl_autoload_register!
        // this is intended to preserve old autoloader

        $uses_autoload = function_exists('__autoload')
            && (!($tmp = spl_autoload_functions()) || ($tmp[0] === '__autoload'));

        // Prepending PHPTAL's autoloader helps if there are other autoloaders
        // that throw/die when file is not found. Only >5.3 though.
        if (version_compare(PHP_VERSION, '5.3', '>=')) {
            spl_autoload_register(array(__CLASS__,'autoload'), false, true);
        } else {
            spl_autoload_register(array(__CLASS__,'autoload'));
        }

        if ($uses_autoload) {
            spl_autoload_register('__autoload');
        }
    }