[REBOL] Rolling your own ideal looper: does Repeat still have a bug? Re:(6)
From: lmecir:geocities at: 31-Aug-2000 8:35
Hi,
> Ladislav,
>
> That is an impressive For function!
> your example of using
> >a: [1 2]
> >for s a tail a 1 [print s]
> as a test is very amusing bug, looks
> like an infinite loop on windows, just
> keeps printing newlines without ever ending.
>
> Just for kicks, I just tried this:
> >> for s a back tail a 1 [print s]
> 1 2
> 2
>
> so that it stops at the last real position,
> and that seemed to work, althout the expression
> is more awkward and wordy!
>
> Your other example is this:
> >> for s a next a -1 [print s]
> 1 2
>
> which I am not sure I get.
> This would never get to next a by skipping -1.
> Either you have a typo here, or I missed the point.
>
Simple, For should stop immediately as for integers, because it is
already behind the limit.
> If this were integers, it would look like
> for x = 1 30 step -1
>
> >> for s a next a 1 [print s]
> 1 2
> 2
>
> What is the proper behavior of
> >> for s a next a -1 [print s]
> ???
>
> -Galt
>
> p.s. As far as the second-class vs. first-class values
> goes, I am inclined to agree with you. There are some
> fishy issues that don't seem entirely cooked. You are
> right to bring them up for discussion. So far, however,
> in the programs that have come up naturally in my
> use of Rebol, I haven't been banging into these issues
> alot. I have seen the errorhandling stuff e.g. try, disarm
> seems like it's more awkward than it should be.
> I could run smack into more of them at any moment,
> though!
>
> p.p.s. I think the desire to share Rebol data and
> objects across the net between two instances of rebol.exe,
> or storing them and retrieving them later in native Rebol
format,
> will come up strongly in the near future.
> Even the RebMail program might be a lot simpler if
> you could just save your mail objects and reload later.
> Having to create extra functions for converting from
> Rebol to some other disk structure and then back
> again is a pain. I think Rebol can do better.
> It just needs to make a few new tricks available...
>
You are right with data saving - even data copying in Rebol may be
an unsolvable problem.