diff --git a/stdlib/effects.affine b/stdlib/effects.affine index 4408e059..259bf22f 100644 --- a/stdlib/effects.affine +++ b/stdlib/effects.affine @@ -18,7 +18,9 @@ extern fn read_file(path: String) -> String / io; extern fn write_file(path: String, content: String) -> Unit / io; // Built-in State operations -extern fn ref(x: T) -> Ref / state; +// `make_ref` (not `ref`) because `ref` is a reserved ownership keyword; +// see #135 keyword-as-identifier slice. +extern fn make_ref(x: T) -> Ref / state; extern fn get(r: Ref) -> T / state; extern fn set(r: Ref, x: T) -> Unit / state; diff --git a/stdlib/result.affine b/stdlib/result.affine index 32cce913..17078644 100644 --- a/stdlib/result.affine +++ b/stdlib/result.affine @@ -225,8 +225,10 @@ fn result_or(a: Result, b: Result) -> Result { // Error Handling Patterns // ============================================================================ -/// Try block emulation - execute function and catch panics as Err -fn try(f: () -> T) -> Result { +/// Try block emulation - execute function and catch panics as Err. +/// Named `attempt` (not `try`) because `try` is a reserved keyword +/// (try/catch/finally); see #135 keyword-as-identifier slice. +fn attempt(f: () -> T) -> Result { // TODO: Requires exception handling support try { Ok(f())