Closed l1mey112 closed 1 year ago
For what?
I apologise for not going further in depth.
These two assertions are used to guard branches or functions at runtime.
It allows you to easily block out your program and work the parts you need to. The entire function signature can be written out, then have it's body marked as unimplemented. Or A match case's else branch be marked as unreachable. It conveys an intent of implementing the functionality later and allows V to type check stub functions marked as such.
It's pretty niche but used quite a lot in other languages. For example, rust has unreachable!()
and unimplemented!('reason')
macros, in python raise NotImplementedError
. A common method I use in C programs is assert(0 && "reason");
Since it's a snippet, it will be super quick to write. Like I said, maybe it's too niche, but it would be incredibly useful to have.
- lm
I want to add two snippets to the VSCode extension, I use these quite a lot.
snippet.unimpl
snippet.unreach
Let me know if this is helpful!