<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>Also, one question that I haven't seen come up yet: Would this behavior change affect closures? I'm inclined to say that closures that declare a type explicitly should get this behavior (because it's easy to add @allow_unused_result to those), but closures whose type is inferred should not have this behavior.<br></div>
<div> </div>
<div>And that brings to mind a second question: How about functions that are generic in their return type? For example, `withExtendedLifetime<T,Result>(_: T, _: T throws -> Result) rethrows -> Result`. The return type may be Void in many cases, but when it's not Void it still may not be meaningful. It's hard to know from the generic function whether the compiler should warn if the return type is unused; my inclination is to say it shouldn't warn by default, because it's rather common to execute these sorts of functions for their side-effects. Which is to say, if the function is capable of returning Void, then it should not warn without an explicit @warn_unused_result attribute (which does mean we need to keep that attribute even if that becomes the default). The rationale being that a Void return type means the function is executed for its side-effects, and so a non-Void return type may also be executed for side-effects, and functions that are executed for their side-effects shouldn't warn.<br></div>
<div> </div>
<div>-Kevin Ballard</div>
<div> </div>
</body>
</html>