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

Stephan Hennig mailing_list at arcor.de
Sun Mar 4 11:30:58 CET 2007


Ryan Van Wagoner schrieb:
>>>>>> "Stephen Hennig" == Stephan Hennig <mailing_list at arcor.de> writes:
> 
>  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.

I'd look for that information in the manual and ... it's already there.
 dataline_,  of course, were a more verbose variable name and would
probably have caught my attention earlier.  Counting line numbers is
exactly what I was doing.


> Unfortunately such a change at this point would break compatibility for
> previously written files depending on `i' doing what it does now.

Yes, too bad.

Best regards,
Stephan Hennig



More information about the metapost mailing list