From 11539792ffcbdba74d6ca63dea2be937d62de7fc Mon Sep 17 00:00:00 2001 From: Xander Date: Fri, 28 Jul 2023 00:57:36 +0200 Subject: Added template init_exec function --- lib/DATS/init.dats | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/DATS/init.dats') diff --git a/lib/DATS/init.dats b/lib/DATS/init.dats index 492d5dc..a4c84b3 100644 --- a/lib/DATS/init.dats +++ b/lib/DATS/init.dats @@ -7,3 +7,17 @@ let in @{initialized = false, obj = v}: initializable vt end + + +implement{vt} init_exec (x) = + if x.initialized then + let + prval () = opt_unsome x.obj + val () = init_exec$fwork (x.obj) + prval () = opt_some x.obj + in + end + +implement{vt} init_exec$fwork (v) = () + + -- cgit v1.2.3