|
| 1 | +(* Js_of_ocaml library |
| 2 | + * http://www.ocsigen.org/js_of_ocaml/ |
| 3 | + * Copyright (C) 2024 Olivier Nicole |
| 4 | + * |
| 5 | + * This program is free software; you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU Lesser General Public License as published by |
| 7 | + * the Free Software Foundation, with linking exception; |
| 8 | + * either version 2.1 of the License, or (at your option) any later version. |
| 9 | + * |
| 10 | + * This program is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | + * GNU Lesser General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU Lesser General Public License |
| 16 | + * along with this program; if not, write to the Free Software |
| 17 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | + *) |
| 19 | + |
| 20 | +(** Javascript-specific effect functions. *) |
| 21 | + |
| 22 | +external assume_no_perform : (unit -> 'a) -> 'a = "caml_assume_no_perform" |
| 23 | +(** Passing a function [f] as argument of `assume_no_perform` guarantees that, |
| 24 | + when compiling with `--effects=double-translation`, the direct-style |
| 25 | + version of [f] is called, which is faster than the CPS version. As a |
| 26 | + consequence, performing an effect in a transitive callee of [f] will raise |
| 27 | + `Effect.Unhandled`, regardless of any effect handlers installed before the |
| 28 | + call to `assume_no_perform`, unless a new effect handler was installed in |
| 29 | + the meantime. |
| 30 | +
|
| 31 | + This behaviour is the same when double translation is disabled. *) |
0 commit comments