WebAssembly / WASI

WebAssembly System Interface
Other
4.82k stars 249 forks source link

[witx] Make `use` import individual names from other modules #378

Closed sunfishcode closed 3 years ago

sunfishcode commented 3 years ago

Witx's current mechanism for supporting declarations across multiple files is use which imports the contents of one file into another. This was a simple way to get witx started, however it isn't amenable to splitting up WASI into multiple modules.

A better approach would be to have use work more like a proper module system in high-level programming languages, where one can use specific items from other modules.

So instead of

(use "typenames.witx")

We should have something like

(use $timestamp from $wasi_filesystem)

where $wasi_filesystem is a module which defines a$timestamp` type.