Skip to content

Type escapes its scope #9

@dhil

Description

@dhil

In the following program the type of st escapes its scope

effect state = Get : 's

let my_comp () = perform Get + 1

let state m =
  match m () with
  | v -> fun _ -> v
  | effect Get, k -> fun st -> continue k st st

The computation my_comp instantiates Get : 's to Get : int locally. Loading the above in OCaml repl with rlwrap, we can now crash the OCaml runtime:

- : int = 42
# state my_comp 'e';;
- : int = 102
# state my_comp "Hello World";;
rlwrap: warning: ocaml crashed, killed by SIGSEGV (core dumped).
rlwrap itself has not crashed, but for transparency,
it will now kill itself with the same signal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions