Skip to content

Commit 8772f22

Browse files
mbouazizclaude
andcommitted
Add Unsafe.unsafe_untracked_call to stdlib
Provides a controlled escape hatch for calling untracked functions from tracked contexts (e.g., performing I/O inside reactive computations where the caller takes responsibility for correctness). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ddf3686 commit 8772f22

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

skiplang/prelude/src/core/Unsafe.sk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,13 @@ native fun array_set_byte<T>(v: mutable Array<T>, i: Int, b: UInt8): void;
100100
@cpp_extern
101101
native fun string_ptr(v: String, i: Int): Runtime.NonGCPointer;
102102

103+
// Calls an untracked function from a tracked context.
104+
// Use this to perform side effects (e.g., file I/O) inside reactive
105+
// computations where you take responsibility for correctness and
106+
// invalidation.
107+
@allow_tracked_call
108+
untracked fun unsafe_untracked_call<T>(f: untracked () -> T): T {
109+
f()
110+
}
111+
103112
module end;

0 commit comments

Comments
 (0)