News for hackers. Stuff that matters.
Re:A proposal to add signals to JavaScript by bastawhiz on Sunday March 31, 2024 @05:18PM (#39888148)
Interpreted languages rarely have macros.

But more importantly, do you really want script tags on webpages defining macros that globally affect how other files are parsed/interpreted? What if the macro references an identifier that's not global? What if I define a macro in a script that loads after some other JavaScript has already run? Do macros affect eval() and the output of Function.prototype.toString?

Sure, you could scope macros to one script/module to prevent code from blowing up left and right, but now you need to repeat your macro definitions in every file you create. You could avoid that by bundling your js into one file, but now you're back to using a compiler, which makes the whole thing moot.

Re:A proposal to add signals to JavaScript by pcthrowaway on Monday April 01, 2024 @01:29AM (#39891171)
It turns out there might actually be a benefit of the compilation step which has been introduced now that everyone uses Typescript... would be really interesting to see macros get added, though I suspect it's too far away from Typescript's mandate to add as few new features on top of Javascript as possible