News for hackers. Stuff that matters.
Re:Homoiconicity Revisited by kazinator on Friday June 05, 2020 @12:15PM (#23430190)
TXR Lisp keeps a weak hash table which associates objects in the syntax with file/line information, without changing their representation in any way.

There is no need for ugly, cumbersome syntax objects that destroy Lisp.

Whether or not the recording of source loc info is enabled is controlled by a special variable. It is disabled by default, because you probably don't want that overhead if you're calling the reader for reams of data. Functions like compile-file and load enable it locally.

To take advantage of the info for error reporting in a user defined macro, you can simply do this:

   (defmacro mymacro (:form f arg1 arg2 ...) ;; get the form using :form
     (when (somehow-no-good arg1) ;; something wrong with arguments
       (compile-error f "first argument ~s is no good!" arg1))
     ...)
You get an error which mentions mymacro, and the location.

   (foo.lisp:10) mymacro: first argument 42 is no good!
Re:Homoiconicity Revisited by xscott on Thursday June 11, 2020 @02:39PM (#23491976)
This is interesting and clever - thank you for sharing it. However, it seems like the hash table would work on either the address or the shape of the code, and in either case you could build a pathological case which would break it. It's probably a really nice solution for the common/realistic case though.