diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-10-06 21:13:45 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-10-06 21:13:45 -0700 |
commit | 8beabcd33ac984ee454f0871ffd45b940e279732 (patch) | |
tree | 624c01ce0d390ef86975d88033249d44ab6c0417 /txr.1 | |
parent | 829f02b346d4060e64ec5847cbd0f066edd4a144 (diff) | |
download | txr-8beabcd33ac984ee454f0871ffd45b940e279732.tar.gz txr-8beabcd33ac984ee454f0871ffd45b940e279732.tar.bz2 txr-8beabcd33ac984ee454f0871ffd45b940e279732.zip |
New function: replace-struct.
* struct.c (replace_struct): New function.
(struct_init): Register replace_struct intrinsic.
* struct.h (replace_struct): Declared.
* txr.1: documented replace-struct.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -18745,6 +18745,48 @@ if omitted. Note that finalizers are not executed prior to replacing the slot values. +.coNP Function @ replace-struct +.synb +.mets (replace-struct < target-obj << source-obj ) +.syne +.desc +The +.code replace-struct +function causes +.meta target-obj +to take on the attributes of +.meta source-obj +without changing its identity. + +The type of +.code target-obj +is changed to that of +.codn source-obj . + +All instance slots of +.code target-obj +are discarded, and it is given new slots, +which are copies of the instance slots of +.codn source-obj . + +Because of the type change, +.code target-obj +implicitly loses all of its original static slots, +and acquires those of +.codn source obj . + +Note that finalizers registered against +.meta target-obj +are not invoked, and remain registered. +If +.meta target-obj +has state which is cleaned up by +finalizers, it is advisable to invoke them using +.code call-finalizers +prior to using +.codn replace-struct , +or to take other measures to handle the situation. + .coNP Function @ method .synb .mets (method < struct-obj << slot-name ) |