WebAssembly / tail-call

Proposal to add tail calls to WebAssembly
https://webassembly.github.io/tail-call/
Other
111 stars 8 forks source link

Multiple tail call instructions, or a prefix instruction? #2

Closed ElvishJerricco closed 4 years ago

ElvishJerricco commented 6 years ago

Opening this issue to discuss this question from the proposal overview.

ElvishJerricco commented 6 years ago

If WebAssembly intends to add other call instructions, we may find that they have slightly different syntactic requirements to support tail calls. If this is a concern, we should probably go with the many different tail call instructions, so they can all have their own tailored syntax.

titzer commented 6 years ago

I think having multiple tail-call instructions has the main advantage of simplicity, both in encoding and decoding. To a rough approximation, for consumers, prefix bytes create a "nested decoder loop" or require passing information from one decoding location to another. Multiple tail call instructions allow an implementation to just have a "flat table" of decoding. It also makes clear that tail calls have different behavior, rather than just a modification of existing behavior.

rossberg commented 4 years ago

We went for multiple.