<< Back to previous view

[CLJ-849] Add a pseudo-variable containing the current line number Created: 07/Oct/11  Updated: 15/May/17

Status: Open
Project: Clojure
Component/s: None
Affects Version/s: Release 1.3
Fix Version/s: None

Type: Feature Priority: Minor
Reporter: G. Ralph Kuntz, MD Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


Attachments: File CLJ-849-line-number-pesudo-variable.diff    


Add a pseudo-variable (similar to *file*), containing the current line number. This should be available during AOT compilation. The name "*line-number*" might be good.

It will be useful for diagnostic log messages. Using exception stack traces has poor runtime performance and the line number should be available to the compiler at minimal cost.

Comment by Peter Siewert [ 14/Nov/12 3:41 PM ]

Adding initial patch. A symbol's position is now stored in its metadata, just like a seq when it is read with the LispReader.

The Compiler.LINE and Compiler.COLUMN values are now updated as each symbol is analyzed. This provides more exact line and column numbers for Compiler errors which will resolve ticket CLJ-420.

The Compiler.LINE variable has been interned as clojure.core/line-number

Adding extra metadata to symbols resulted in some tests failing due to the extra values. The failing tests have been updated to ignore the new metadata keys.

Comment by Andy Fingerhut [ 22/Jul/13 3:46 PM ]

Patch CLJ-849-line-number-pesudo-variable.diff dated Nov 14, 2012 used to apply cleanly and pass tests, but no longer applies cleanly after Jul 7 2013 when a conflicting change with subject "don't presume Integer for LINE and COLUMN, fixes round-trip" was committed to Clojure: https://github.com/clojure/clojure/commit/229bf8fe9a751e4f48bb2b7ea57e27ebc43d26ae

Generated at Thu Jan 18 22:03:30 CST 2018 using JIRA 4.4#649-r158309.