[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

Re: [zzdev] To loop or not to loop?

Tuukka Hastrup wrote:
> I hope you now understand what I mean with the "duality" of the lists:
> you can look at them as loops or non-loops. Only the entity using the
> list will know if it wants a loop or a non-loop. I guess there could be
> a situation when it would mean something to have it as a loop or not.
> Could you give me an example? Or I'll give you one: We have a list of
> commands to execute. If it loops it's a loop, if not, it returns at the
> end. Here it would be clearer to have a special "loop" command to return
> to headcell. Better examples?

Huh? No, it wouldn't be clearer to have a "loop" command. It's much,
much clearer just to have the thing loop. It's one of the places where
having loops is wonderful thing.

Generally, I think we can say: The entities "wanting" loops those which
STEP through something -- like a scripting engine stepping through a
list of commands, or a view stepping through possible dimensions. If we
want that these steppers go through a list infinitely, or as long as
they don't find something that makes them do something else, we make the
list loop; if we don't want them to, we don't make it loop.

That's a very clean way of doing this, as it comes directly from the ZZ
structure and no new constructs need to be defined for it.

And then we have the entities which don't want loops, and just ignore
them. To them, it doesn't make a difference if something loops or not --
to the steppers, it does.

- Benja