[REBOL] Re: for bug?
From: g:santilli:tiscalinet:it at: 19-Jun-2002 12:38
Hi Joel,
On Wednesday, June 19, 2002, 6:12:17 AM, you wrote:
JN> That's a nice first cut, but it assumes that the object passed
JN> to FOREACHIN will be able to deliver at least one value (since
JN> the UNTIL loop doesn't check for failure until after trying to
JN> evaluate the body on CURRENT.
Indeed. My first version was using THROW on /NEXT, but I realized
it was probably uselessly complicated, as the issue with "no
iteration at all" can be dealt differently.
JN> 2) Require the object to have two methods /MORE? and /NEXT
JN> where /MORE? indicates whether it is possible to call /NEXT
JN> without failure, and /NEXT returns the next unused value
JN> from the iterator.
I have a third: let the first /NEXT be no-op, and return
immediately true if there's nothing to do. Anyway, your seems the
simplest.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r