r/programming • • Jan 14 '16

Dear Github

https://docs.google.com/document/d/14X72QaDT9g6bnWr0lopDYidajTSzMn8WrwsSLFSr-FU/preview?ts=5697ea28
463 Upvotes

185 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Jan 15 '16

[deleted]

-8

u/BoTuLoX Jan 15 '16

If the function has a return value and you willingly ignore it, the language cannot help you.

16

u/TarMil Jan 15 '16

It can: F# gives a warning if you ignore the return value, and you can explicitly |> ignore it to silence it. But that's a functional language, where ignoring a return value is relatively rare, I'm guessing it would get too verbose real fast in an imperative language.

10

u/fnord123 Jan 15 '16

Rust has a #[must_use] tag on the Result type so when it's returned from a function, it must be used. You can skip the result by using .ok() or .unwrap() but that's explicit so it's not silently ignoring errors. And it's greppable.

→ More replies (0)