Re: Individual bulk e-mails - performance question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert Cummings schreef:
On Sun, 2008-08-31 at 21:42 +0200, Jochem Maas wrote:
Robert Cummings schreef:

....

I assume that this is coming from your interjinn lib, and that it's
aimed at php4 (given the ampersands your throwing about)

also your LockManager object seems to have a get() and getRef()
method which do the same ... or is that typo?

Lol, I didn't even know that it supported the get() version. I thought
I'd simplify the details when posting and so reimmed off the Ref.

haha. oh and it looks like I get to call you on a non-existent word 'reimmed' :-P

To
make a long story long, we all know about PHP4's deficiencies and how
passing objects around caused them to copy. Well when I created
InterJinn I had a need to ensure that objects were always the requested
singleton. As such I created a wrapper class which the non ref version
would return with a single member variable called "do". Do was a
reference to the real object and so passing around the wrapper caused
copies of the wrapper to occur but the original object ref remained
intact since PHP4 returned shallow copies. With PHP5 this is no longer
necessary and so for backwards compatibility objects are returned as
before but the object returned is the requested object which has a
member variable called do that happens to be a reference to itself. The
name "do" was chosen because it makes the code still read well.

sneaky little trick :-) I like it. it's almost a pity I don't do anything
with php4 ;-)

So for instance in PHP4 you might do:

   $lock = $mLock->get( $someName )
   $lock->do->destroy();

In PHP5 you might do:

   $lock = $mLock->get( $someName )
   $lock->do->destroy();

   or

   $lock->destroy()

So PHP5 benefits from the better object model, but PHP4 compatibility is
still maintained making the move forward to PHP5 that much easier. The
getRef() option was provided in many cases so that programmers that know
how to properly manage their references could skip the whole wrapper
overhead.

Cheers,
Rob.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux