John LeSueur wrote:
Again, the case you've cited is probably not a case where generators give much advantage. But anytime the logic to produce some data becomes more complicated (Imagine that you needed to skip some of the lines in the .csv file based on some kind of filter), then being able to extricate the producer logic from the consumer logic is helpful.
But in my 'method of working' one simply changes the '$contact->' object and loads the one that matches the data you are handling. Sage, paypal, moneybox, nlpg and so on. I've a dozen or so data models currently. "skip some of the lines" simply equates to saving or not some of the detail lines such as shopping basket details on paypal or property details in nlpg. The base RecordLoad takes care of that but in reality one always saves all of the data, and later access to the database provides any filtering required when processing results for the screen. I suppose that the 'producer logic' is populating the database, while the 'consumer logic' is later reading that data back - filtered as required. If I was keeping everything in memory things would probably be different ... but I still can't see why the work flow has to be reorganised rather than simply following the natural flow that the job requires. Adding 'yield' how ever it's added loads additional development work on all of the ancillary tools many of which still haven't caught up with the 5.3 extras let alone 5.4, and doesn't seem to provide any outstanding advantages?
-- 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