anko / eslisp

un-opinionated S-expression syntax and macro system for JavaScript
ISC License
528 stars 31 forks source link

Source maps are unhelpful when used with transform macros #35

Open anko opened 8 years ago

anko commented 8 years ago

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:

I like the first better.

yousefamar commented 8 years ago

:+1:

I agree that the first sounds better.