diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-08-28 07:18:40 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-08-28 07:18:40 -0700 |
commit | 448dd8e3d0581e0ae95244ed8e399f6e5caff9f1 (patch) | |
tree | d67404320f20a455333096cbba8eeee97018d0e7 /txr.1 | |
parent | b46add7c71d8c0399901926ac014fd9338e0f371 (diff) | |
download | txr-448dd8e3d0581e0ae95244ed8e399f6e5caff9f1.tar.gz txr-448dd8e3d0581e0ae95244ed8e399f6e5caff9f1.tar.bz2 txr-448dd8e3d0581e0ae95244ed8e399f6e5caff9f1.zip |
doc: :fini also affected by diamond problem.
* txr.1: Document that the change in behavior to initialize a
duplicate base just once also affects :fini, not only
initialization. Example expanded.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 29 |
1 files changed, 25 insertions, 4 deletions
@@ -26268,23 +26268,35 @@ initialization. When an object is instantiated, only one initialization of a duplicated supertype occurs. The subsequent initializations that would take place in the absence of duplicate detection are suppressed. +Note also that the +.code :fini +mechanism is tied to initialization. Initialization of an object +registers the finalizers, and so in \*(TX 242, +.code :fini +finalizers are also executed multiple times, if +.code :init +initializers are. + .TP* Examples: Consider following program: .verb (defstruct base () - (:init (me) (put-line "base init"))) + (:init (me) (put-line "base init")) + (:fini (me) (put-line "base fini"))) (defstruct d1 (base) - (:init (me) (put-line "d1 init"))) + (:init (me) (put-line "d1 init")) + (:fini (me) (put-line "d1 fini"))) (defstruct d2 (base) - (:init (me) (put-line "d2 init"))) + (:init (me) (put-line "d2 init")) + (:fini (me) (put-line "d2 fini"))) (defstruct s (d1 d2)) - (new s) + (call-finalizers (new s)) .brev Under \*(TX 242, and earlier versions that support multiple inheritance, it @@ -26295,6 +26307,10 @@ produces the output: d2 init base init d1 init + d1 fini + base fini + d2 fini + base fini .brev The supertypes are initialized in a right-to-left traversal of the @@ -26308,10 +26324,15 @@ Starting with \*(TX 243, the output is: base init d2 init d1 init + d1 fini + d2 fini + base fini .brev The rightmost duplicate of the base is initialized, so that the initialization is complete prior to the initializations of any dependent types. +Likewise, the same rightmost duplicate of the base is finalized, so that +finalization takes place after that of any dependent struct types. Note, however, that the .code derived |