b29aa052fdbb — Leonard Ritter 2 months ago
* added `writable?` function to query if a pointer is mutable
1 files changed, 8 insertions(+), 0 deletions(-)

M lib/scopes/core.sc
M lib/scopes/core.sc +8 -0
@@ 3323,6 3323,14 @@ let
             fn "constant?" (args)
                 let value = (extract-single-arg args)
                 `[('constant? value)]
+    writable? =
+        make-const-type-property-function
+            fn (T)
+                if (== ('kind T) type-kind-pointer)
+                    'writable? T
+                else
+                    hide-traceback;
+                    error "pointer type expected"
     signed? =
         make-const-type-property-function
             fn (T)