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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php