1 hour ago · Tech · 0 comments

Fir macros are fully deterministic programs that are distributed separately and that can introspect into the using program’s type-checked AST definitions. Deterministic execution of macros is necessary to be able to Cache macro results in the language server and between compilation of a package during development. Avoid the issues with build scripts in many languages that can run arbitrary code when compiling a package, causing all kinds of security nightmares. Potentially distribute packages with macros fully expanded. This makes dependency trees smaller as importing a package doesn’t bring in its macro dependencies. Avoid leaking compiling platform details into generated code, which makes cross-compilation difficult. Separate distribution is not a requirement but it simplifies the implementation quite significantly, and it’s also a good idea from a software design point of view: With macros in the same package with the use sites, you have to compile some parts of the package with…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.