On Wed, 2006-12-20 at 12:27 +0100, Jochem Maas wrote:
> Robert Cummings wrote:
> > On Wed, 2006-12-20 at 11:49 +0100, Jochem Maas wrote:
> >>> How about iterators? You can have objects that look like arrays yet they
> >>> take
> >>> much less memory:
> >>>
> >>> $rs = $db->query($select); # query the db
> >>> foreach ($rs as $row) { # fetch the row
> >>> whatever($row);
> >>> }
> >> ah yes - good catch, I do like iterators for keeping code nice and tight.
> >
> > I don't what you guys did in PHP4, but I do the following:
> >
> > <?php
> >
> > if( $db->query( $query ) )
> > {
> > while( ($row = $db->fetchRow()) )
> > {
> > whatever( $row );
> > }
> > }
> >
> > ?>
> >
> > I fail to see the need for an iterator. But, I'll grant you, proper
> > destructor support is nice.
>
> I agree that there is no *need* for iterator (as your example demonstrates);
> yet I do like the functionality - basing things on the 'need' argument alone
> and
> taking it right down to the fundamentals ... why do we need php? why do we
> need internet?
> or even computers? in truth we *need* none of these things (I can't eat it,
> sleep under it or
> breathe it) ;-P
Absolutely, but the OP asked if there was anything compelling enough to
switch to PHP5... and so the concept of need versus desire was on the
table :)
> I like iterators, and in that sense it's like having warmed seating in the
> car - not needed
> but I like it! having a new programming style/paradigm/<fit-better-word-here>
> in php5
> might be a reason for some to step over.
>
> I write code because I enjoy it - if all there was was assembler I would
> probably
> never have got it the game - to me the development experience is something I
> care about ...
> there is a reason I don't play with Perl (namely reading Perl code generally
> makes me feel
> sea-sick). that said experience is personal, some, apparently, avoid php for
> the same reason
> I avoid Perl.
>
> that said php avoidance is silly - resistance is futile, we will assimilate
> ;-)
Cheers to that!
Happy Winter Solstice!
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php