From 8357dd0ce75b5cace504acfcef2c31ee83a35e9c Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 17 Oct 2022 08:12:10 -0700 Subject: defstruct: new :inherit clause. The :inherit clause allows custom struct clauses to inject inherited bases. * stdlib/struct.tl (defstruct): Recognize :inherit clause, adding symbol arguments to extra list of supers that get appended to the list coming from defstruct's seconda rgument. (define-struct-clause): Disallow :inherit clause name. * tests/012/oop-dsc.tl: New tests. * txr.1: Documented. --- txr.1 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index a15cb390..2342276d 100644 --- a/txr.1 +++ b/txr.1 @@ -29602,6 +29602,30 @@ form, all the finalizers execute after all the .code :fini finalizers regardless of the order in which they appear. + +.meIP (:inherit << super *) +The +.code :inherit +clause specifies zero or more types to be inherited. Each +.meta super +argument must be a symbol which is the name of an existing struct type. +These symbols are appended to the list of supertypes coming from the +.meta super +argument +.codn defstruct . +Note: the motivation behind +.code :inherit +is to make it possible for struct clauses defined by +.code define-struct-clause +to inject supertypes. Developers are encouraged to use the regular +.meta super +argument of +.code defstruct +to declare inheritance of supertypes, rather than writing visible +.code :inherit +clauses that can be moved into the +.meta super +argument. .RE .IP The slot names given in a -- cgit v1.2.3