[TYPO3-project-4-3] FYI: patch for autoloader is in the BT

Dmitry Dulepov dmitry.dulepov at gmail.com
Sat Oct 25 21:29:10 CEST 2008


Hi!

Martin Kutschker wrote:
> t3lib_div::makeInstance uses a private static variable. Maybe you didn't
> read the thread where we talked about singletons, but it turned out that
> it is better (for the unit tests we may see some day) to use a storage
> outside of the class itself (in our case t3lib_div::makeInstance).

It will not look good... You will have to use one of these two:

$autoload = t3lib_div::makeInstance('t3lib_autoload');
$autoload->installAutoloader();

or

t3lib_div::makeInstance('t3lib_autoload')->installAutoloader();

I think mine looks better:

t3lib_autoload::getInstance()->installAutoloader();

It is more elegant and more obvious. Or it could be changed to:

t3lib_autoload::installAutoloader();

and inside this method it could create an instance and initialize
it. But there will be a need for a static guarding variable to avoid
second call to this method.

> I agree. There is still time even for the first alpha.

Funny, I just found BT entry #9116. Many ideas are the same...

-- 
Dmitry Dulepov
TYPO3 translations support
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book
In the blog:
http://typo3bloke.net/post-details/get_typo3_coding_guidelines_here/


More information about the TYPO3-project-4-3 mailing list