From f43fda4e635370689fc248bb7e94e5861151df2c Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 9 Jul 2021 08:21:15 -0700 Subject: defstruct: diagnose built-in type being redefined. * eval.c (eval_init): Register built-in-type-p intrinsic. * lib.c (buitin_type_p): Rename to built_in_type_p since the word built-in is hyphenated. The function also tests whether the argument is a COBJ class. (cobj_class_exists): Function removed. * stdlib/doc-syms.tl: Updated. * stdlib/struct.tl (defstruct): Add built-in-type-p check. * struct.c (make_struct_type): Call only built_in_type_p; cobj_class_exists is gone. * txr.1: Document built-in-type-p. --- stdlib/struct.tl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'stdlib/struct.tl') diff --git a/stdlib/struct.tl b/stdlib/struct.tl index bd62637f..9108ab02 100644 --- a/stdlib/struct.tl +++ b/stdlib/struct.tl @@ -39,6 +39,8 @@ (atom (list atom nil))) (unless (bindable name) (compile-error form "~s isn't a bindable symbol" name)) + (if (built-in-type-p name) + (compile-warning form "~s is a built-in type" name)) (unless (proper-listp slot-specs) (compile-error form "bad syntax: dotted form")) (let* ((instance-init-form nil) -- cgit v1.2.3