Stream: wasmtime

Topic: ✔ Behavior of Linker#get_default


view this post on Zulip Saúl Cabrera (Jan 24 2022 at 16:56):

Hi :wave: I'm trying to understand the implementation of get_default in wasmtime's Linker. More concretely: it treats "" as a default export, but I haven't seen this in any of the specs. Is there an underlying reason/use-case for this behavior?

view this post on Zulip Dan Gohman (Jan 24 2022 at 17:00):

It's something of an experiment. It comes from thinking about wasm components built to be run as commands. We have the _start convention today, but the way it handles command-line arguments isn't great. And looking forward, in a command-like wasm component, all exports should effectively be entrypoints, and it's desirable to have one as the default so that users can "just run" it.

view this post on Zulip Dan Gohman (Jan 24 2022 at 17:02):

Using the empty string for the default export is perhaps a little too subtle, but it does kind of have a nice way of suggesting "the export you get if you don't specify a specific entrypoint name"

view this post on Zulip Saúl Cabrera (Jan 24 2022 at 17:40):

That makes sense, thanks for the input @Dan Gohman

view this post on Zulip Notification Bot (Jan 24 2022 at 17:40):

Saúl Cabrera has marked this topic as resolved.


Last updated: Nov 22 2024 at 16:03 UTC