summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-07-09 08:07:02 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-07-09 08:07:02 -0700
commitc6cc120ad042fa234da17cf929c6fdfae1000a5b (patch)
tree1b4537d65bfece34b3176242a364f7c6df77e0da /txr.1
parent618a854df42cb43e410ba488a6634dae16a3e36f (diff)
downloadtxr-c6cc120ad042fa234da17cf929c6fdfae1000a5b.tar.gz
txr-c6cc120ad042fa234da17cf929c6fdfae1000a5b.tar.bz2
txr-c6cc120ad042fa234da17cf929c6fdfae1000a5b.zip
struct: rework stype_handle change.
The change which allows stype_handle to recognize struct instances, and obtain their type, has some possibly unwanted ramifications, since the function is widely used. Let's refactor things so that, for now, only the struct_type_name function takes advantage of this flexibility. * struct.c (stype_handle_impl): New static function, copy of stype_handle, but taking an obj_ok Boolean argument to indicate whether an object instance is an acceptable argument, whose type should be fetched. (stype_handle): Now a wrapper around stype_handle_impl passing nil for the obj_ok argument. (stype_handle_obj): New static function. Passes t for the ok_obj argument of stype_handle_impl. (struct_type_name): Call stype_handle_obj instead of stype_handle. (super): Take advantage of stype_handle_obj to reduce code. * txr.1: Update documentation of struct-type-name, and improve that of super.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.137
1 files changed, 20 insertions, 17 deletions
diff --git a/txr.1 b/txr.1
index 9d5ae2b1..c36be80c 100644
--- a/txr.1
+++ b/txr.1
@@ -28993,39 +28993,42 @@ returned by
.coNP Function @ struct-type-name
.synb
-.mets (struct-type-name << type )
+.mets (struct-type-name << type-or-struct )
.syne
.desc
The
.code struct-type-name
-function returns the symbol which serves as the name of
-.metn type ,
-which must be either a struct type object (such as the return value of
+function determines a structure type from the
+.meta type-or-struct
+and returns that structure type's symbolic name.
+
+The
+.meta type-or-struct
+argument must be either a struct type object (such as the return value of
a successful lookup via
.codn find-struct-type ),
-or else a struct type name.
+a symbol which names a struct type,
+or else a struct instance.
.coNP Function @ super
.synb
-.mets (super << type )
+.mets (super >> [ type-or-struct ])
.syne
.desc
The
.code super
-function returns the struct type object which is the
-supertype of
-.metn type ,
-or returns
+function determines a structure type from the
+.meta type-or-struct
+and returns the struct type object which is
+the supertype of that type, or else
.code nil
-if
-.meta type
-has no supertype.
+if that type has no supertype.
The
-.meta type
-argument must be either a struct type object, a
-a symbol which names a struct type (which is resolved to that type),
-or else a structure instance (which is resolved to its structure type).
+.meta type-or-struct
+argument must be either a struct type object,
+a symbol which names a struct type,
+or else a struct instance.
.coNP Function @ make-struct
.synb