in reply to Reset the effect of #line

The functions which generate the code don't know what file they are writing to, and keeping track of the current output line seems like a big hassle, so generating #line directives for my own code isn't really possible.

The Perl compiler only keeps track of one file name and one "current line number" for each stream of code that it is compiling. So supporting a "pop" (or "reset") feature for #line isn't really possible.

Well, for your definition of the word "possible", which seems a rather non-standard one.

That said, I think having a "reset" feature for "#line" is a fine idea. In a quick test, '#line 0' had the strange impact of making the next line of input "not from any line" but the line after it being "line 1". '#line 5 ""' is identical to '#line 5' (the empty string is ignored).

So we could patch Perl so that '#line 0' resets the current line number to be real line number and so that '#line 9 ""' resets the current file name to be the original file name. Of course, '#line 0 ""' would reset both.

However, keeping track of two different file names and two different "current line number"s for each stream of source code seems like a big hassle. So if you want it done, you'll probably have to write the patch for Perl yourself. See S_incline() in p5git://toke.c..

- tye