Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Question about variables in module behavior

$
0
0

you would actually get the same behavior in ocaml, go to ocaml playground and copy paste this:

module MyModule = struct
  let state = ref([])

  let make (foo: string)  = 
    state := foo :: !state;
    state
end

let a1 = MyModule.make "a";;
let a2 = MyModule.make "b";;
Printf.printf "a1 = a2 ? %b" (!a1 = !a2);;
(* prints a1 = a2 ? true *)

Viewing all articles
Browse latest Browse all 2592

Trending Articles