Open guest271314 opened 1 year ago
I would rather specify the following:
If the WAT file starts with a
#
followed by an!
everything from the start of the file until the first newline shall be interpreted as comment.
;;#!
is not something that any OS will interpret. It can only be interpreted once a program that supports reading WAT files has already started at which point I don't think there should be a possibility to run another program instead. UNIX systems only interpret #!
at the start of the file without anything before it to determine which program to run.
Currently the Text Format specification does not define a means to call a WASM executable from within the WAT file, see https://github.com/bytecodealliance/wasmtime/issues/3715.
Reading the specification(s) https://github.com/WebAssembly/spec/blob/4c249c5a575e2b0e252e747af261bbb82f448dd4/interpreter/README.md, https://webassembly.github.io/spec/core/text/conventions.html#grammar this sounds reasonable
file.wat
Prospective specification text:
The above change should not affect existing WAT usage, where it is highly unlikely WAT files in existence contain that precise sequence of characters at positions 0-3 in the file.
I found this limitation when using
wasmtime
to execute WASM as a Native Messaging host.This is the current workaround I'm using to use WAT in a Bash sheel script, call
wasmtime
(which does not exit when the parent exits) using WAT Text Format in the same file, then terminatewasmtime
in a separate script when the Native Messaging host exits.nm_c_wat.sh
kill_wasmtime.sh
Pros, cons, discussion. I cannot champion this because W3C banned me. So either one of you champion this or it doesn't happen.
1. The #! magic, details about the shebang/hash-bang mechanism on various Unix flavours