CLOVIS
10/07/2026, 8:42 PMinline fun foo(block: () -> String) {
bar()
block()
}
and bar() is documented that it should never throw in normal operations, am I allowed to declare block as InvocationKind.EXACTLY_ONCE ?
In the event that bar() throws an exception, block() will not be called, but then again the exception will bubble up breaking the caller too, so it shouldn't matter to them?Gleb Minaev
10/07/2026, 8:50 PMEXACTLY_ONCE is used only to understand local contracts (like "local variable is initialized"). But if the function throws, then the local scope will be destroyed (it will propagate the exception without continuing its execution), so the contracts do not matter anymore.Youssef Shoaib [MOD]
10/08/2026, 5:41 AMCLOVIS
10/08/2026, 8:09 AM