laria icon indicating copy to clipboard operation
laria copied to clipboard

Missing `extern fn` definitions should panic ASAP instead of on first use

Open PatchMixolydic opened this issue 3 years ago • 0 comments

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.

PatchMixolydic avatar May 02 '22 06:05 PatchMixolydic