|
2 | 2 | // AffineScript Standard Library - Effect Declarations |
3 | 3 |
|
4 | 4 | // Core IO effect - file and console operations |
5 | | -effect io; |
| 5 | +effect IO; |
6 | 6 |
|
7 | 7 | // State effect - mutable references |
8 | | -effect state; |
| 8 | +effect Mut; |
9 | 9 |
|
10 | 10 | // Exception effect - panics and error handling |
11 | | -effect exn; |
| 11 | +effect Throws; |
12 | 12 |
|
13 | 13 | // Built-in IO operations |
14 | | -extern fn print(s: String) -> Unit / io; |
15 | | -extern fn println(s: String) -> Unit / io; |
16 | | -extern fn read_line() -> String / io; |
17 | | -extern fn read_file(path: String) -> String / io; |
18 | | -extern fn write_file(path: String, content: String) -> Unit / io; |
| 14 | +extern fn print(s: String) -> Unit / IO; |
| 15 | +extern fn println(s: String) -> Unit / IO; |
| 16 | +extern fn read_line() -> String / IO; |
| 17 | +extern fn read_file(path: String) -> String / IO; |
| 18 | +extern fn write_file(path: String, content: String) -> Unit / IO; |
19 | 19 |
|
20 | 20 | // Built-in State operations |
21 | 21 | // `make_ref` (not `ref`) because `ref` is a reserved ownership keyword; |
22 | 22 | // see #135 keyword-as-identifier slice. |
23 | | -extern fn make_ref<T>(x: T) -> Ref<T> / state; |
24 | | -extern fn get<T>(r: Ref<T>) -> T / state; |
25 | | -extern fn set<T>(r: Ref<T>, x: T) -> Unit / state; |
| 23 | +extern fn make_ref<T>(x: T) -> Ref<T> / Mut; |
| 24 | +extern fn get<T>(r: Ref<T>) -> T / Mut; |
| 25 | +extern fn set<T>(r: Ref<T>, x: T) -> Unit / Mut; |
26 | 26 |
|
27 | 27 | // Built-in Exception operations |
28 | | -extern fn panic(msg: String) -> Never / exn; |
29 | | -extern fn error<T>(msg: String) -> T / exn; |
| 28 | +extern fn panic(msg: String) -> Never / Throws; |
| 29 | +extern fn error<T>(msg: String) -> T / Throws; |
30 | 30 |
|
31 | 31 | // Pure operations (no effects) |
32 | 32 | extern fn int_to_string(n: Int) -> String; |
|
0 commit comments