# ADT, SPL

- Thread: https://externals.io/message/2589
- Original archive: https://news-web.php.net/php.internals/2589
- Started by Stanislav Malyshev on 2003-06-23T07:34:41+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #2589 — Stanislav Malyshev — 2003-06-23T07:34:41+00:00

URL: https://externals.io/message/2589#2589

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?

-- 
Stanislav Malyshev, Zend Products Engineer   
stas@zend.com  http://www.zend.com/ +972-3-6139665 ext.109

---

## #2590 — Sebastian Bergmann — 2003-06-23T07:46:37+00:00

URL: https://externals.io/message/2589#2590 · In reply to: #2589

Stanislav Malyshev wrote:
> Can't it be done without keeping another copy of entire Zend engine?

  As Sterling already mentioned, it should be merged into Zend at some
  point in time, preferably before PHP 5 :)

-- 
  Sebastian Bergmann
  http://sebastian-bergmann.de/                 http://phpOpenTracker.de/

         http://www.professionelle-softwareentwicklung-mit-php5.de/

---

## #2626 — Sterling Hughes — 2003-06-23T15:57:59+00:00

URL: https://externals.io/message/2589#2626 · In reply to: #2589

> SB>> > Anybody cares to explain what SPL is?
> SB>> 
> SB>>   http://cvs.php.net/cvs.php/spl
> 
> > […]
> 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
