Rasmus Lerdorf wrote:
I don't think this generator question is any different. We need to
explain generators in the simplest way possible. The simplest way to
explain generators is to not even worry about them being generators at
all. Simply say that functions can now return arrays one element at a
time using the new yield keyword. That's all.

It's this 'concept' that I am having trouble seeing in the general process that is required using PHP to generate web pages. At the end of the day I have to generate the finished page or sub-page so I need all the results anyway. Part of my own problem in understanding may be that all my persistent data is in a database, and processing the SQL queries to efficiently serve up only the data needed for that particular page is paramount for speed. SQL has the concept of SUSPEND in procedures, but one would not use that here due to the processing overheads. One builds the array of results and processes it to provide the data to be fed to the client either while getting the dataset back from the database ( the html elements form part of the query ) or the much faster approach, you get only the data stored in the initial array, and then iterate that array to add the wrapper. Since in many shared hosting cases the database is on another machine, you want to keep the amount of traffic between machines as small as possible. OR is the point of this concept that we can suspend operation and return later to do the next set of the list?

In the examples given so far, even the new ones on why 'callback' does not work, understanding WHAT the end list of data is going to contain is difficult to work out and picking up the increasing amount of similar code being added to libraries makes maintaining them ever more difficult. But then perhaps I'm just getting too old for this and it's time to throw in the towel :( I'm certainly not enjoying all the agro keeping things working at all ...

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to