wit-bindgen icon indicating copy to clipboard operation
wit-bindgen copied to clipboard

Consider splitting configuration of foreign types into a new `generate!` macro config key

Open rylev opened this issue 1 year ago • 1 comments

In https://github.com/bytecodealliance/wit-bindgen/pull/972 the default for whether bindings would be generated for foreign (i.e., not in the same package as the target world) types was flipped from being generated by default to not. Users could still opt-into generating code for foreign types by using the generate keyword.

The use of a special keyword, however, might not be the most discoverable. Instead we may wish to introduce a new key in the generate! macro.

In short the following...

with: {
    "wasi:io/poll": wasi::io::poll,
    "some:package/my-interface": generate,
},

...would become the following...

with: {
    "wasi:io/poll": wasi::io::poll,
},
generate: [
    "some:package/my-interface"
]

rylev avatar Jul 01 '24 16:07 rylev

Seems reasonable to me!

alexcrichton avatar Jul 08 '24 18:07 alexcrichton