[metapost] [graph.mp] bug in gdata?

Ryan Van Wagoner whiteviz at gmail.com
Sun Mar 4 02:29:42 CET 2007

>>>>> "Stephen Hennig" == Stephan Hennig <mailing_list at arcor.de> writes:

 Stephen Hennig> [Full quote, because this mail wasn't copied to the list.]

 Thanks for catching that.  I hit `Reply' instead of `Followup'.

 Stephen Hennig> Why use i at all here?  What about

 Stephen Hennig> forever: exitunless ... ?

Using forever would definitely work in this case.  I neglected to copy
the comment in front of the def for gdata which provides some context:

% Execute c for each line of data read from file f, and stop at the first
% line with no data.  Commands c can use line number i and tokens $1, $2, ...

So it appears that the intention is to provide an index of the line
number in case the user wants to use that information for, e.g.,
labeling plot points or for processing.  It does make things more
difficult, however, if someone inadvertantly collides with the
variable.  Perhaps it would make more sense to use a more descriptive
variable name such as `dataline_'.  That way there is less chance of a
collision, yet the line is there for someone to find in the source code,
which is where they would look if they needed something like that.
Unfortunately such a change at this point would break compatibility for
previously written files depending on `i' doing what it does now.



Ryan Van Wagoner

More information about the metapost mailing list