Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007526OCamllanguage featurespublic2017-05-04 16:012017-05-09 16:10
Assigned To 
PlatformOSOS Version
Product Version4.03.0 
Target VersionFixed in Version 
Summary0007526: add (optional) warning on all non-tail calls (unless [@stackcall] attribute is present)
DescriptionThe compiler currently support the following warning:

    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 [^] is fixed too)
Attached Files

- Relationships

-  Notes
frisch (developer)
2017-05-09 11:55

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.
domsj (reporter)
2017-05-09 14:35

Hmm, for all calls it indeed doesn't make sense.
I actually only had recursive calls in mind when I created the ticket.
frisch (developer)
2017-05-09 16:10

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).

- Issue History
Date Modified Username Field Change
2017-05-04 16:01 domsj New Issue
2017-05-04 19:37 gasche Tag Attached: junior_job
2017-05-07 10:29 dra Status new => acknowledged
2017-05-09 11:51 frisch Severity major => feature
2017-05-09 11:55 frisch Note Added: 0017786
2017-05-09 14:35 domsj Note Added: 0017787
2017-05-09 16:10 frisch Note Added: 0017788

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker