Re: Package proposal: Unique

From: Date: Wed, 25 Jun 2003 17:20:18 +0000
Subject: Re: Package proposal: Unique
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17716@lists.php.net to get a copy of this message
Hi! cagrET wrote:
Class:
    function &instance()
    {
        static $instance;
        return $instance;
    }
Example: $Uniq =& Unique::instance(); $Uniq will be null here, unless I'm missing something.
before calling instance() u call factory() so it will contain object
1) factory() is not called in "example"; 2) it won't contain any object, 'cause the reference to 'static $instance' is *never* accessed/assigned to in factory(). The whole [non-working] 'factory' and 'instance' stuff looks like a "me too" implementation of design patterns without bothering to understand them.
this is not PEAR's DB class http://scg.milc.com.pl/cagret/mgcLib/Db/
Wow! Yet Another Database "Abstraction" Layer For PHP! :] "mgcLib::Db is a database library for php. Currently it supports MySQL and PostgreSQL ... NOTE: pgsql driver has not been testet yet (looking for some volunteer)"
i just proposed an idea
The idea is good, I used this approach several years ago, but the [attempt at] implementation kinda sux.

« previous php.pear.dev (#17716) next »