Version 3 of line number

Updated 2002-02-07 07:39:48

"How do I calculate the line number of ...?" is a very frequently-asked question.

There's no satisfying answer, in general. While introspection is generally one of Tcl's strengths, no one has yet invested what's necessary to implement a line-number calculation satisfyingly.

[Explain difficulties (byte-coded vs. not, in script vs. proc body vs. eval)?]

[Various ways to instrument existing procedures ... ]

[Tom Tromey once wrote extension (?) to do this. Arjen Markus' Testcov (?) does a nearly (?) identical instrumentation. (Arjen: not quite, it is available on the Neosoft archive now, but it rewrites the source code, interspersing calls to counting procedures and then when the program is run, the instrumented files are sourced. So things are not happening "on the fly"]

[tclguy's summary: "it is going to have to be somebody's science project"]