From 7eef2749ca3282585e65415712ebb810f2462a01 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 22 Dec 2021 21:29:13 -0800 Subject: new feature: defstruct clause macros. * lisplib.c (struct_set_entries): Trigger autoload on new symbols define-struct-clause and *struct-clause-expander*. * stdlib/struct.tl (*struct-clause-expander*): New variable. (defstruct): expand-slot local function now returns list of expanded slots, not a single slot; every case in the tree-case is converted to return a list. The syntax of a slot clause is first expanded through *struct-clause-expander hash; if that works then the resulting list is further scanned for expansions. (define-struct-clause): New macro. (:delegate): New struct clause defined with define-struct-clause. Provides single-slot delegation. * tests/012/oop.tl: Tests for :delegate. * txr.1: Documented define-struct-clause and :delegate. * stdlib/doc-syms.tl: Updated. --- stdlib/doc-syms.tl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'stdlib/doc-syms.tl') diff --git a/stdlib/doc-syms.tl b/stdlib/doc-syms.tl index 63894b85..8b263b4c 100644 --- a/stdlib/doc-syms.tl +++ b/stdlib/doc-syms.tl @@ -76,6 +76,7 @@ ("/" "D-0049") ("//" "N-0054C409") ("/=" "N-003BE40C") + (":delegate" "N-037F664C") (":key" "N-01697547") (":match" "N-03B92C0D") ("<" "D-0057") @@ -468,6 +469,7 @@ ("define-option-struct" "N-0126C738") ("define-param-expander" "N-019F25A5") ("define-place-macro" "N-02C3089A") + ("define-struct-clause" "N-00FF2A51") ("defmacro" "N-02CAEF0B") ("defmatch" "N-0049315A") ("defmeth" "N-0047C7E8") -- cgit v1.2.3