From 983a0d26b0d119e0cac73e1a529541c253436d9e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 9 Dec 2019 20:20:48 -0800 Subject: doc: clarify inheritance of static slot value. * txr.1: In relation of the previous bugfix, a certain situation is worth clarifying. A static slot does not inherit the value of a grandparent type's static slot of the same name, if the supertype has specified that slot as an instance slot. Inheritance of the static slot value is from the direct supertype only. --- txr.1 | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index 5ea0cac6..450cbca7 100644 --- a/txr.1 +++ b/txr.1 @@ -25267,6 +25267,37 @@ but are of a different kind: an instance slot in the supertype can be replaced by a static slot in the derived type or .IR "vice versa" . +Note that, in light of the above type overriding possibility, the static slot +value propagation happens only from the immediate supertype. +If +.code D +is is derived from +.code G +which has a static slot +.codn s , +whereas +.code D +specifies +.code s +as an instance slot, but then +.code B +again specifies a static slot +.codn s , +then +.codn B 's +slot +.code s +will not inherit the value from +.codn G 's +.code s +slot. +Simply, +.codn B 's +supertype is +.code D +and that supertype is not considered to have a static slot +.codn s . + A structure type is associated with a static initialization function which may be used to store initial values into static slots. This function is invoked once in a type's life time, when the type is created. -- cgit v1.2.3