[swift-evolution] Make non-void functions @warn_unused_result by default

Dmitri Gribenko gribozavr at gmail.com
Wed Mar 2 15:46:45 CST 2016


On Wed, Mar 2, 2016 at 1:38 PM, David Owens II <david at owensd.io> wrote:
> Had the API been marked as discardable, there's no way to tell if you've
> made an oversight error or were being explicit about not needing the result.

The point you are making is true of any source-level annotations that
can't be verified by the compiler independently.  For example,
force-unwrapping an optional -- there is no way to tell, either for a
compiler or even another engineer, whether force-unwrapping is a logic
error or not.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/


More information about the swift-evolution mailing list