Borrowing internal pointers in ATS

Run Settings
LanguageATS
Language Version
Run Command
#include "share/atspre_define.hats" #include "share/atspre_staload.hats" viewtypedef X = @{ a = int, b = int } extern viewtypedef "X" = X %{ int* get_b_ref(X* x) { return &x->atslab__b; } %} extern fun get_b_ref {l: addr} (pf: X @ l | x: ptr l) :<> [l2: addr] (int @ l2, int @ l2 -<lin> X @ l | ptr l2) = "mac#get_b_ref" symintr <~ nonfix <~ overload <~ with get_b_ref implement main0 () = () where { var x: X = @{ a=1, b=2 } val (pf, pff | p) = <~ (view@ x | addr@ x) val _ = !p := 3 prval () = view@ x := pff(pf) val () = println! ("x.b = ", x.b) }
Editor Settings
Theme
Key bindings
Full width
Lines