Commit b120dcf
Add unsafe_untracked_call to allow tracked code to call untracked functions
SKStore lazy mappers run in a tracked context, which prevents them from
calling untracked (side-effectful) functions. This is correct for most
cases, but some use cases—such as lazy file system access in mappers—
legitimately need to perform I/O during reactive computation, with the
caller taking responsibility for correctness and invalidation.
This adds:
- A new @allow_tracked_call annotation that exempts an untracked function
from the "Cannot call an untracked function from a tracked context" error
- Unsafe.unsafe_untracked_call<T>, a generic function that takes an
untracked lambda and calls it, usable from tracked contexts
- A typechecker test exercising the new functionality
The annotation check is implemented in tfun_call (skipTyping.sk) by
looking up the callee's annotations before invoking check_tracking.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent a897f79 commit b120dcf
4 files changed
Lines changed: 38 additions & 1 deletion
File tree
- skiplang
- compiler
- src
- tests/Typechecking
- prelude/src/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1882 | 1882 | | |
1883 | 1883 | | |
1884 | 1884 | | |
1885 | | - | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
1886 | 1896 | | |
1887 | 1897 | | |
1888 | 1898 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
103 | 112 | | |
0 commit comments