Hacker News new | ask | show | jobs
by kazinator 702 days ago
It's reading code from a file, which you can make arrangements for to be there at any time you want.

Files are not directly relevant to macros.

The code that a macro invocation has access to by design is the datum which comprises that invocation itself. That may have come from an expression in a file, and may be annotated in some way with the location info. Other than that, macros do not necessarily have access to their textual source code. No such thing necessarily exists because macros can be invoked by code that was generated (possibly by other macros or in other ways) and so never existed as characters in a file.

I don't have a clear picture of the architecture of the system that the article refers to, but the author presents, as his end result, a defn form, which defines a function and not a macro.

If a macro is needed to get that function to be called at compile time, that would be a minor hooking detail, and not an instance of a macro being used to perpetrate a complex code transformation. The function just needs a file name and a string.

(It looks as if the author's system may be interactive; the code files are there all the time and can be changed, and he wants the view of the files to refresh?)