savi
savi copied to clipboard
Add support for TODO markers in code
Rust has todo! or unimplemented! macros, both of which panic when executed.
In addition, I often find myself adding comments like XXX, TODO, FIXME or TBD in the code and then grepping the source code for them to see what needs to be fixed. That definitively works well. On the other hand it would be nice to have a Savi "declarator", that triggers a compiler warning. So when compiling with -Werror (treating warnings as errors), it will complain about these TODO/FIXME items.
:fun abc
todo: This needs to be fixed before release!
The advantage would be that there would be only one official way to mark TODO items vs someone using "XXX" or "TODO" in a comment or "TBD"...
I'd keep it separate from a possible unimplemented! "macro", which I would use in cases where I don't want to provide an implementation (yet). Idris (a dependently-typed language) uses ?-holes for that, that allows the inferred type of the hole to be queried (interactively), which again is another interesting use case (probably LSP can do the same).
In Rust, todo! and unimplemented! behave the same (they both panic), with the only difference that places marked with todo! are intended to be fixed later on by the programmer, whereas places with unimplemented! might stay unimplemented forever.
@mneumann - Which of these are you expecting:
:a: A "TODO" marker shows some kind of warning/error when compiling, but has no other effect :b: A "TODO" marker shows some kind of warning/error when compiling, and if the program encounters one during execution it crashes the program and prints the message and location
My use case is :a:, where I have some working code that I want to test and maybe even roll out as preview version, but when it hits the public, I really want to fix some remaining issues. So maybe it's more a fixme than a todo.
For instance, in Rust I want to remove all remaining unwrap calls (that panic!). Or I want to review security. Or refactor the code a bit. It's definitively working code (todo! in Rust is not working code).
Related work #448