Version 7 of line number

Updated 2006-11-10 03:19:24

"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"]

escargo 9 Nov 2006 - Perhaps somebody could explain how the information is available to the error handlers but not available to Tcl introspection.


Category Internals