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

add (optional) warning on all non-tail calls (unless [@stackcall] attribute is present) #7526

Closed
vicuna opened this issue May 4, 2017 · 4 comments

Comments

@vicuna
Copy link

vicuna commented May 4, 2017

Original bug ID: 7526
Reporter: domsj
Status: acknowledged (set by @dra27 on 2017-05-07T08:29:56Z)
Resolution: open
Priority: normal
Severity: feature
Version: 4.03.0
Category: language features
Tags: junior_job

Bug description

The compiler currently support the following warning:

51
Warning on non-tail calls if @tailcall present.

I think it would make sense to have another warning which turns the logic around:
give a warning for every non-tail call, unless the user explicitly chooses to suppress the warning (using e.g. an attribute [@stackcall]).

(of course this will be most useful if #7525 is fixed too)

@vicuna
Copy link
Author

vicuna commented May 9, 2017

Comment author: @alainfrisch

Definitely not a "Major" issue. Marking as a feature request.

My opinion is that the proposal is not a great idea. Warnings are supposed to help enforce good coding style and catch potential errors. I don't think that any realistic project will be written in a style where all non-tail calls should be marked explicitly. Non-tail calls are not intrinsically "bad", and are actually very common; having to mark all of them would add too much noise.

So I propose to close the ticket, unless someone feels strongly about it.

@vicuna
Copy link
Author

vicuna commented May 9, 2017

Comment author: domsj

Hmm, for all calls it indeed doesn't make sense.
I actually only had recursive calls in mind when I created the ticket.

@vicuna
Copy link
Author

vicuna commented May 9, 2017

Comment author: @alainfrisch

Ok, this a bit less extreme, but still, non-tail recursion is the standard way to navigate on recursive data structures. I'm personally not in favor of adding a warning to discourage this style, esp. considering that its specification and implementation would not be straightforward (one needs to distinguish "recursive calls" from others) and would necessary be somehow imperfect (a "recursive" call could be hidden in various ways).

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

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

2 participants