At 09:53 21/3/01 -0800, Alex Smith wrote: >Peter Donald <[EMAIL PROTECTED]> wrote: > >[re: foreach being evil and SQL's select being good] > >>select has zero ordering semantics > >Foreach also has zero ordering semantics. In fact, saying 'SELECT * FROM >MyTable' is equivalent to 'foreach (*) in MyDirectory'. (In reality both >select and foreach impose default ordering on the result set but that still >doesn't produce a valid argument against either).
Well where foreach has been implemented it often does have ordering semantics (as a matter of fact I can't think of a implementation that does not have ordering semantics - can you?). However very few decent (I can't think of any) implementations of SQL have ordering semantics at that level (people who know the underlying strategy/structures/db can force a particular ordering but that was no inherent in SQL last time I read about it). >SELECT * FROM MyTable WHERE (SELECT ...) is roughly equivalent to > >foreach $file in MyDirectory > foreach $extension in $file > print $file.$extension oh really ? Luckily you have that ketword "roughly" eh? ;) Cheers, Pete *-----------------------------------------------------* | "Faced with the choice between changing one's mind, | | and proving that there is no need to do so - almost | | everyone gets busy on the proof." | | - John Kenneth Galbraith | *-----------------------------------------------------*
