commit 194abeb1e0f0b28b95abe8119c663aff2bf2645f
parent 4c70395b748f76fa9a86906a6485c7dc6d54a753
Author: Ed van Bruggen <edvb@uw.edu>
Date: Thu, 25 Mar 2021 00:28:33 -0700
Don't allow modifying primitive variables with set
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/tisp.c b/tisp.c
@@ -997,6 +997,8 @@ form_set(Tsp st, Hash env, Val args)
}
if (!e || !e->key)
tsp_warnf("set!: variable %s is not defined", car(args)->v.s);
+ if (e->val->t == TSP_PRIM) /* TODO hard code other values */
+ tsp_warnf("set!: can not modify %s, is primitive procedure", e->val->v.pr.name);
e->val = val;
return val;
}