Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effects: double translation of functions and dynamic switching between direct-style and CPS code #1461

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Nov 5, 2024

  1. Effects: double translation of functions and

    ... dynamic switching between direct-style and CPS code. (ocsigen#1461)
    OlivierNicole authored and vouillon committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    88b0fc3 View commit details
    Browse the repository at this point in the history
  2. Add caml_assume_no_effects primitive and tests

    Passing a function [f] as argument of `caml_assume_no_effects`
    guarantees that, when compiling with `--enable doubletranslate`, the
    direct-style version of [f] is called, which is faster than the CPS
    version. As a consequence, performing an effect in a transitive callee
    of [f] will raise `Effect.Unhandled`, regardless of any effect handlers
    installed before the call to `caml_assume_no_effects`, unless a new
    effect handler was installed in the meantime.
    
    Usage:
    
    ```
    external assume_no_effects : (unit -> 'a) -> 'a = "caml_assume_no_effects"
    
    ... caml_assume_no_effects (fun () -> (* Will be called in direct style... *)) ...
    ```
    
    When double translation is disabled, `caml_assume_no_effects` simply
    acts like `fun f -> f ()`.
    
    This primitive is exposed via `Js_of_ocaml.Js.Effect.assume_no_perform`.
    OlivierNicole authored and vouillon committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    a34c448 View commit details
    Browse the repository at this point in the history