You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, the compiler cannot resolve source locations beyond where macros are called. It deliberately treats macros as black boxes, to insulate user macros from having to know anything about the location data stored on S-expression nodes.
Example: If someone has defined a macro hello and call it as (hello there a b c d), currently anything at all that hello call returns is just sourcemapped to the macro's call site.
This backfires majestically with transform macros.
Transform macros are just like user macros that take the whole program as their arguments and return whatever they feel like. The calls to them have no in-source location, and they are not necessarily location-data aware, so anything they emit (which is the whole program) is sourcemapped to… nowhere. You just get an empty source map. It sucks.
Some possibilities:
Let macros return whatever location data they want to—it's up to its author to decide if it's worth it for their specific one. Wait for transform macros to be replaced with reader macros (and have those return location data), so the effect of other macros not deciding to return location data is minimal.
Require all macros to be aware of location data and to emit location data on the nodes they return, and have the compiler enforce this. (This makes macros more complex to write.)
I like the first better.
The text was updated successfully, but these errors were encountered:
At the moment, the compiler cannot resolve source locations beyond where macros are called. It deliberately treats macros as black boxes, to insulate user macros from having to know anything about the location data stored on S-expression nodes.
Example: If someone has defined a macro
hello
and call it as(hello there a b c d)
, currently anything at all thathello
call returns is just sourcemapped to the macro's call site.This backfires majestically with transform macros.
Transform macros are just like user macros that take the whole program as their arguments and return whatever they feel like. The calls to them have no in-source location, and they are not necessarily location-data aware, so anything they emit (which is the whole program) is sourcemapped to… nowhere. You just get an empty source map. It sucks.
Some possibilities:
I like the first better.
The text was updated successfully, but these errors were encountered: