Hacker News new | ask | show | jobs
by static_void 390 days 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?

1 comments

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.
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.
> No, because 99.9999% of the time, you explicitly do not want the compiler implicitly filling in a hole like that

Who are you to tell me what I want? You are making all manner of tacit assumptions about the kind of work I do and what my requirements are. I absolutely do want the compiler filling in every hole it possibly can. For me, that's the whole point of using a high-level language in the first place. For the kind of work I do, what matters most is getting things done as quickly as possible. Correctness and run-time efficiency are secondary considerations.

If correctness is a secondary consideration, then you'll be happy to learn that LLMs will let you code in plain English, so there's no need to bother with using a programming language at all. The LLM will happily fill in all the holes it encounters, more eagerly than any compiler would ever dream of.

But for people who prioritize precision and correctness, that's what programming languages were invented for.

There are two problems with using LLMs for writing code. The first is that when the code they produce doesn't work (which is most of the time) I still have to debug it, and now I'm debugging someone else's (or someTHING else's) code rather than my own. The second is that the work I do is very specialized (custom ASIC design) and LLMs are utterly useless.

But yeah, if all you need to do is build a vanilla app then an LLM is probably an effective tool.