Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:2626 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4313 invoked from network); 23 Jun 2003 16:05:51 -0000 Received: from unknown (HELO hasele) (216.179.74.133) by pb1.pair.com with SMTP; 23 Jun 2003 16:05:51 -0000 Received: by hasele (Postfix, from userid 1000) id A51B74ED6A; Mon, 23 Jun 2003 11:57:59 -0400 (EDT) To: Stanislav Malyshev Cc: Sebastian Bergmann , internals@lists.php.net In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-ID: <1056383879.6262.161.camel@hasele> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 23 Jun 2003 11:57:59 -0400 Subject: Re: [PHP-DEV] ADT, SPL From: sterling@bumblebury.com (Sterling Hughes) On Mon, 2003-06-23 at 03:34, Stanislav Malyshev wrote: > SB>> > Anybody cares to explain what SPL is? > SB>> > SB>> http://cvs.php.net/cvs.php/spl > > >From the initial look at the code, it seems it contains a large parts of > duplicated engine code. Which means, unless I am missing something, > constant maintenance nightmare. Can't it be done without keeping another > copy of entire Zend engine? SPL, or at least the parts I'm interested in provide a standard set of interfaces for PHP5, and then it overloads certain ops to allow for, for example, foreach() overloading. So you can do: class PHP_Devs implements spl_iterator { function next() { return $nextphpdev; } } $p = new PHP_Devs; foreach ($p as $dev) { echo $p; } This stuff is very useful, especially internally (its actually only the internal ramifications that i personally care about). Imagine developing a database extension, where you can go: $result = $sth->result; foreach ($result as $row) { echo $row[0]; } And *every* part of that is overloaded, and lazy initialized. That provides a great speed boost compared to the traditional database extensions (you save a lot of unnecessary function calls, and in some cases, fetches). Marcus can probably expound on some of the other features of SPL. -Sterling -- "Microsoft isn't evil, they just make really crappy operating systems." - Linus Torvalds