staload
"share/atspre_staload.hats"
staload
_ = "prelude/DATS/reference.dats"
local
var theGlobalCount_var : int = 0
val theGlobalCount = ref_make_viewptr (view@ theGlobalCount_var | addr@ theGlobalCount_var)
in // in of [local]
fun
theGlobalCount_get () : int = ref_get_elt (theGlobalCount)
fun
theGlobalCount_set (n: int): void = ref_set_elt (theGlobalCount, n)
end // end of [local]
implement main0 () = let
val () = theGlobalCount_set (10)
val n1 = theGlobalCount_get ()
val () = println!("counter: ", n1)
val () = theGlobalCount_set (0)
val () = println!("counter set to 0")
val n2 = theGlobalCount_get ()
val () = println!("counter: ", n2)
in
end