laria
laria copied to clipboard
Missing `extern fn` definitions should panic ASAP instead of on first use
Consider the following code:
extern fn foo() -> i64;
extern fn bar() -> !;
extern fn wait(seconds: f32);
fn main() {
wait(5.0);
foo();
}
If wait is registered, but foo and bar are not, foo will only panic after five seconds, which is at least five seconds wasted testing a broken implementation. Further, the missing definition of bar will never cause a panic, as it is never used. Missing extern fn bindings should instead panic immediately to alert developers to potential bugs ASAP.