|Anonymous | Login | Signup for a new account||2014-04-21 14:32 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0006236||OCaml||OCaml general||public||2013-11-13 14:25||2014-02-19 16:46|
|Target Version||Fixed in Version|
|Summary||0006236: No warning for partly evaluated functions at toplevel|
|Description||let f ~a b = failwith b|
let _ = f "success"
The compiler emits no warning about the last line not being executed completely. The bug looks obvious on this testcase, but it is mind-boggling on a larger piece of code spanning several files. (We had it occur in Why3 recently.)
So it would be great if warning 5 ("this function application is partial, maybe some arguments are missing") was also emitted for anonymous let-statements at top level. (I know that, if "let ()" had been used instead, the compiler would have complained loudly.)
|Tags||No tags attached.|
Intentionally, let _ = expr does not cause any warning.
Using it is at top-level is bad practice.
You should either write
let () = ...
let () = ignore (...)
which will both warn you.
|What about a new warning on all "let _ = ..." bindings? In my opinion, even for local bindings, it is bad style.|
|Please let us not multiply coding-style warnings that could easily be implemented by an external tool. In this case, even emacs should be able to warn you.|
|2013-11-13 14:25||gmelquiond||New Issue|
|2013-11-13 15:06||garrigue||Note Added: 0010633|
|2013-11-14 10:43||frisch||Note Added: 0010634|
|2013-11-30 23:28||doligez||Status||new => acknowledged|
|2014-02-19 16:46||doligez||Note Added: 0010950|
|Copyright © 2000 - 2011 MantisBT Group|