top | item 44035762

(no title)

static_void | 9 months ago

In Rust, the `todo!()` macro will fill in type holes without needing to be finished.

Surely you can't be against putting a TODO in an unfinished part of the code?

discuss

order

lisper|9 months ago

I'm against anything that adds cognitive load without a compelling reason, anything makes me do unnecessary work. Typing "todo!()" is not a huge burden, but it's not zero, and if the Rust compiler is smart enough to fill in the hole it should be smart enough to do it without my having to explicitly tell it.

kibwen|9 months ago

No, because 99.9999% of the time, you explicitly do not want the compiler implicitly filling in a hole like that, and do want the compiler to tell you that you've forgotten an entire branch of control flow. Typing `todo!()` to make your intent explicit is among the least obtrusive things imaginable.