Fix SB-EXT:COMPILE-FILE-LINE
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
New
|
Undecided
|
Unassigned |
Bug Description
Having the ability to derive file and line numbers at compile time would be very useful for a functionality like logging, assertions, or other application specific forms of reporting.
Douglas Katzman provided us with SB-EXT:
Unfortunately, after few attempts we gave up on this macro for various reasons:
- it contained several bugs that surfaced when compiling a large (>> 1M LOC) Lisp project.
E.g. the code relied on the assumption that forms referenced by form-paths are always lists,
while quotes and commas in macros generate structures that have form-paths.
- it was difficult to debug and understand the code. I.e. it contained multiple loops, multiple
ways to call itself recursively, duplicated code with slight alterations, and virtually
no comments about how it works besides: "Modulo any bugs due to near-total lack of testing."
- the interface was a macro that would produce a (VALUES <line> <column>) form,
which is strange when what the user wants is a function that can be called at compile time.
Attached is a fix that simplifies the code and does not break at compile time for the aforementioned project. We had to rewrite/remove the "compute-
Things for further consideration.
It would be nice if the function "compute-
to provide functional access to the information without need of macroexpand.
tags: | added: reader |