News for hackers. Stuff that matters.
Re:JavaScript Macros in Bun by spankalee on Friday June 30, 2023 @04:38PM (#36541890)
The main JS implementations do not run ahead of the spec. They implement at Stage 3.
Re:JavaScript Macros in Bun by jakelazaroff on Friday June 30, 2023 @04:47PM (#36542035)
Import attributes are at Stage 3: https://tc39.es/proposal-import-attributes/
Re:JavaScript Macros in Bun by spankalee on Friday June 30, 2023 @06:26PM (#36543339)
I'm well aware, but this is not just import attributes. It's using import attributes syntax to trigger a transform of the importing module, in addition to changing the behavior of the exporting module.
Re:JavaScript Macros in Bun by eyelidlessness on Friday June 30, 2023 @07:23PM (#36543985)
More concise than my previous reply: that’s just moving the same outcome around in time. If a fully runtime-only import attribute would result in inlining a static-at-build-time value where its export is called, this is just inlining it sooner. That seems fine to me unless it doesn’t fit the import attribute use case. In which case… don’t voluntarily use it?
Re:JavaScript Macros in Bun by paulddraper on Friday June 30, 2023 @06:01PM (#36542998)
A. Import attributes are stage 3.

B. If you blur the line between "runtime" and "compiler", you'll realize that a lot of JS ecosystem (e.g. Babel) run ahead of that.