Skip to content

Add a paragraph describing the prohibition on implicit TCO. - #387

Merged
sunfishcode merged 4 commits into
masterfrom
runaway-recursion
Oct 6, 2015
Merged

sunfishcode merged 4 commits into
masterfrom
runaway-recursion

Conversation

@sunfishcode

Copy link
Copy Markdown
Member

This corresponds with WebAssembly/spec#103

@sunfishcode

Copy link
Copy Markdown
Member Author

Wordsmith integrated. FutureFeatures.md section added. I rewrote "likely to be added" with "planned for the future" which is stronger without quite suggesting more commitment from all parties involved than I'm comfortable making in this PR.

Comment thread AstSemantics.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To address the above objection, perhaps append "which would add an explicit tail-call operation with well-defined effects on stack introspection."?

@sunfishcode

Copy link
Copy Markdown
Member Author

Sounds good to me. Updated.

@jfbastien

Copy link
Copy Markdown
Member

I discussed this with @titzer and @flagxor: we'd rather specify this positively instead of negatively. It would be better to say that the transform should eventually hit a limit, so an optimizer can do TCO but has to either prove that the corresponding loop terminates or keep an implementation-defined limit to model resource exhaustion (as detailed in Nondeterminism.md).

@sunfishcode

Copy link
Copy Markdown
Member Author

@jfbastien If I remove the first sentence of the paragraph, does the rest satisfy your concern?

I added the first sentence as a "plain language" version of what follows, since the theoretical mechanism being inventing here is somewhat abstract and subtle, and I didn't want users or implementors to miss the main point. But I'm open to suggestions on how to clarify it.

@jfbastien

Copy link
Copy Markdown
Member

@sunfishcode yes, dropping the first sentence is good.

I'd also clarify this one:

This rule exists to avoid programs depending on tail call optimizations which may not be portable across implementations.

Calls are already not portable because of their implementation-defined limit! I'd instead say something like:

This rule exists to avoid transforming a program which necessarily runs out of resources into one which cannot possibly exhaust any resource.

@sunfishcode

Copy link
Copy Markdown
Member Author

@jfbastien Ok, I removed the first sentence and rewrote the other sentence. Does this work for you?

@jfbastien

Copy link
Copy Markdown
Member

lgtm

@sunfishcode

Copy link
Copy Markdown
Member Author

Merging with lgtm above and rough consensus in WebAssembly/spec#103.

sunfishcode added a commit that referenced this pull request Oct 6, 2015
Add a paragraph describing the prohibition on implicit TCO.
@sunfishcode
sunfishcode merged commit 4a6b3a3 into master Oct 6, 2015
@sunfishcode
sunfishcode deleted the runaway-recursion branch October 6, 2015 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants