Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit proper tail calls #1760

Closed
DemiMarie opened this issue Oct 3, 2016 · 7 comments
Closed

Explicit proper tail calls #1760

DemiMarie opened this issue Oct 3, 2016 · 7 comments
Labels
T-lang Relevant to the language team, which will review and decide on the RFC.

Comments

@DemiMarie
Copy link

Rust should have a syntax for explicit proper tail calls. I have a pre-RFC on this Internals thread. Is it ready to be proposed as a full RFC?

@ticki
Copy link
Contributor

ticki commented Oct 3, 2016

I'd prefer using attributes, since tail calls ideally shouldn't affect the behavior.

@nrc nrc added the T-lang Relevant to the language team, which will review and decide on the RFC. label Oct 3, 2016
@nrc
Copy link
Member

nrc commented Oct 3, 2016

cc #271

@DemiMarie
Copy link
Author

Tail calls do have an observable effect: they can change a program that
crashes with a stack overflow into one that does not.

On Oct 3, 2016 01:19, "ticki" [email protected] wrote:

I'd prefer using attributes, since tail calls ideally shouldn't affect the
behavior.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1760 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGGWB4w-jQLt-VtxDxylfFVbe6zjjfQ1ks5qwJB8gaJpZM4KMMef
.

@nagisa
Copy link
Member

nagisa commented Oct 3, 2016

That's the practical outlook. In idealised machine (infinite memory) it
makes no difference.

From my watchtower we would evaluate tail call annotations only after it
becomes absolutely clear that whatever TCO we implement is not enough to
cover majority of the usecases by itself.

On Oct 3, 2016 10:10, "Demi Marie Obenour" [email protected] wrote:

Tail calls do have an observable effect: they can change a program that
crashes with a stack overflow into one that does not.

On Oct 3, 2016 01:19, "ticki" [email protected] wrote:

I'd prefer using attributes, since tail calls ideally shouldn't affect
the
behavior.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1760 (comment),
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGGWB4w-jQLt-
VtxDxylfFVbe6zjjfQ1ks5qwJB8gaJpZM4KMMef>
.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#1760 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AApc0krNPoHIjXM0sSXQhvX3Dkpq4q0hks5qwKpLgaJpZM4KMMef
.

@burdges
Copy link

burdges commented Oct 3, 2016

@ticki Attributes sound more like the solution for making non-tail calls explicit: If you want explicit talk calls, then you could write become as suggested here. An attribute version like #[must_tail_call] works, but not sure people want attributes at call sites.

An alternative approach would be to require tail calls in many situations and give warnings in situations that look like tail calls should be required but they seem impossible. An attribute like #[relax_tail_cal_requirement(..)] could be less tied to the call site.

I think explicit tail calls via become or whatever sound good as a start. We should not become overly attached to become though since we might prefer this sort of warning for tail call failure in future.

@eddyb
Copy link
Member

eddyb commented Oct 3, 2016

I'd prefer using attributes, since tail calls ideally shouldn't affect the behavior.

Tail calls (become) need to drop everything in scope before the call, which isn't the case today.

@steveklabnik
Copy link
Member

Closing as a duplicate of #271, let's try to keep each feature to one thread 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-lang Relevant to the language team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

7 participants