Is there a way in Fire to mark a method or class definition as TODO? For example, sometimes I have a placeholder method that I’ll get to later. Does Fire support someway of marking this so it can be flagged as a warning or hint by the compiler when I press ⌘R
to run?
We don’t have a separate #todo directive; me personally, i usually just use #hint
for that?
Fantastic. Works great.
For what it’s worth, I’m not sure if the docs need updating here to give an example of the easier syntax. That page suggests:
[Warning("Foo is not implemented yet, sorry")]
Where:
#warning Foo is not implemented yet, sorry
Works just as well and seems more readable.
Well, these two do very different things
#warning
emits a warning right then and there (same for #hint and #error).
[Warning]
annotates a method or type, so that a warning gets generated when you use it (which might, e.g., be from a different project.
For example, there’s a few methods in Elements RTL that aren’t implemented for all platforms yet, and they are annotated with [Error("not implemented...")]
. That code compiles clean without an error, but when you now try and use that method, you get the error.
The #warning
& Co compiler Directives are documented here: https://docs.elementscompiler.com/Compiler/Directives/