google / schism

A self-hosting Scheme to WebAssembly compiler
Apache License 2.0
1.27k stars 65 forks source link

Add some kind of `include-data` macro #99

Open eholk opened 4 years ago

eholk commented 4 years ago

With factoring rnrs into a separate file (#90), we've lost the nice property that Schism can run from just schism.wasm.

One easy way to get this functionality back would be to add an include-data macro, that would work something like this:

(include-data "filename")

At compile time, we'd read a datum from the file with the given name and include it as a quoted literal. If "filename" contained (1 2 3), then (include-data "filename") would expand to '(1 2 3).

eholk commented 4 years ago

Another option would be to have some way to embed a virtual filesystem in a custom section at the end of the .wasm file. I think this is likely to be more work, but it feels more correct in some ways.