Skip to content

[spec] Rename start function #1073

@rossberg

Description

@rossberg

There has been ongoing confusion about the role of the Wasm start function, what it can do, and how it is different from the exported _start or *start* function convention used in some environments -- see e.g. WebAssembly/design#1160 and links from that discussion. In the 2019/09/17 meeting, the CG hence voted in favour of renaming the notion of start function.

This is almost entirely an editorial change to the spec, except for a corresponding adjustment of the text format (see below).

I propose to rename it to "initialization function" (or "init function" for short); accordingly, the respective section in the binary format would then be called the "init section". That better fits its ability to run initialisation code for a module's state that is guaranteed to be executed before the module becomes available (similar to a class constructor in OO). It also corresponds closely to the notion of init sections in other binary formats.

For the text format, we will then want to allow using the keyword init instead of start to declare this function. There are three options for this change and what to do with the original syntax:

  1. Remove the start keyword immediately, requiring existing code to be adjusted.
  2. Deprecate the start keyword, but keep it for a while until existing code has been adapted.
  3. Keep start indefinitely as a synonym for backwards compatibility.

Note that the start keyword is one of the more exotic features of the Wasm text format, and probably not used a lot outside test code.

Thoughts?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions