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

Compiler option to implicitely add the new [@tailcall] to all functions #6892

Closed
vicuna opened this issue Jun 5, 2015 · 6 comments
Closed

Comments

@vicuna
Copy link

vicuna commented Jun 5, 2015

Original bug ID: 6892
Reporter: berenger
Status: closed (set by @alainfrisch on 2015-06-15T17:31:26Z)
Resolution: not a bug
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)

Bug description

Sometimes, I dream that before releasing a library for general consumption
I could compile it with "--only-tailcalls" before.
I am pretty sure I would even turn this warning into an error for most of my projects ...

@vicuna
Copy link
Author

vicuna commented Jun 5, 2015

Comment author: @gasche

I think you could rather easily implement this as an external -ppx tool. One slightly tricky part is to detect the "innermost" application node to add the attribute (I don't think anything terrible would happen if you annotated each node, except clobbering the AT), but then programmatically adding the attribute should be very simple.

@vicuna
Copy link
Author

vicuna commented Jun 5, 2015

Comment author: @alainfrisch

I must have missing something, but do you suggest to reject:

let y = f x in
...

?

@vicuna
Copy link
Author

vicuna commented Jun 5, 2015

Comment author: berenger

I don't know about ppx things yet.
I hope they don't force people into having more complex
and non standard build descriptions ...

@vicuna
Copy link
Author

vicuna commented Jun 15, 2015

Comment author: @damiendoligez

Like @Frisch, I'm wondering what kind of code you write. Do all your function calls, constructors and records have only variables and constants as arguments?

@vicuna
Copy link
Author

vicuna commented Jun 15, 2015

Comment author: berenger

I thought the [@tailcall] annotation is on the function declaration.
Sorry, this can probably be closed then.

@vicuna
Copy link
Author

vicuna commented Jun 15, 2015

Comment author: berenger

My old dream was that we could have the compiler warn when
we compile a recursive function that is not tail recursive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant