On 10/25/07, Brandon S. Allbery KF8NH <[EMAIL PROTECTED]> wrote: > My point is that there's no promise for that one *even in C*. (The > equivalent construct being adding the new row before nextKey has > failed.)
Sure, but in C, it's highly likely that the full evaluation of the key list happens in one place, that's just how code tends to get written. That said, in C code, I've often seen bugs where code called during the iteration of a collection modifies that collection; that's something that has been really refreshing to get away from when writing Haskell. With the unsafeInterleaveIO example, the "pure" keylist could get deferred indefinitely, stored in a data structure, partially evaluated at many different times against many different versions of the database, etc., and it's not necessarily clear to the person who just has a [Key] that they are doing deferred calls to nextKey like it tends to be in C. It's safe if you use it in a predictable fashion, and in a real API I'd probably provide "getKeys" and "unsafeLazyGetKeys" and let the programmer decide. -- ryan _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
