Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source maps are unhelpful when used with transform macros #35

Open
anko opened this issue Dec 1, 2015 · 1 comment
Open

Source maps are unhelpful when used with transform macros #35

anko opened this issue Dec 1, 2015 · 1 comment
Labels
Milestone

Comments

@anko
Copy link
Owner

anko commented Dec 1, 2015

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.

@anko anko added the bug label Dec 1, 2015
@yousefamar
Copy link

👍

I agree that the first sounds better.

@anko anko changed the title Source maps fail when used with transform macros Source maps are unhelpful when used with transform macros Dec 12, 2015
@anko anko added this to the v1 milestone Jul 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants