Bruce McFarling <agila61@[EMAIL PROTECTED]
> wrote:
> Jonah Thomas <jethom...@[EMAIL PROTECTED]
> wrote:
>
> > If we're talking sheer esthetics, I prefer global variables to
> > locals. They aren't re-entrant, but I can get by wrthout re-entering
> > DRAW .
>
> > But apart from esthetics, doesn't it make sense to use whatever
> > works?
>
> Using a global variable in this situation is not about esthetics. All
> turtle semantics are about a cursor-point and a target-point and
> having those as global variables ex****ts that state to all the turtle
> primitives that are implemented. A PUSH-TURTLE / POP-TURTLE pair
> allows the re-entrant re-use of the global variables at exactly the
> point where desired, without stepping on any factoring, and since they
> are globals, that can be factored out to a wrapper word and does not
> have to be defined in from the outset.
I think I agree with you right down the line, and it sounds vaguely like
you're disagreeing. So I want to make sure I haven't missed the point.
I don't need DRAW-LINE or Line or whatever its name is to be re-entrant
because it might as well be a primitive. I'm never going to stop it in
the middle to do another graphics word.
I might do something else that's re-entrant that uses Line and I can
save the values then. So it isn't a problem for me to use a 2VARIABLE
instead of a double stack variable or a graphics stack etc. And if I
want those, I can use them at a higher level than Line.
Since very often the place I want to start the next line is where the
last line ended, it makes sense to keep that info in a global variable.
For sheer esthetics I prefer as a general rule to avoid variables. but
when they work better, why not use them? Similarly with locals.


|