a code example that shows the order of execution of the init blocks/property initializers
When I look at the sample code I posted at the beginning of this thread, I see no initializer blocks. Because of this, even though I did read through all the sample code and the part that said "initializer blocks are executed in the same order as they appear in the class body, interleaved with the property initializers”, it didn’t register at first that this part applies to me because hey, I don’t have any initializer blocks.
Same thing with “the code in all initializer blocks is executed before the secondary constructor body.” I have property initializers and a secondary constructor, not initializer blocks and a secondary constructor.
Obviously one can mentally bridge the gap and conclude that if initializer blocks are interleaved with property initializers, and initializer blocks are executed before the secondary constructor body, then property initializers are probably also executed before the secondary constructor body.
The improvement would be to spare the reader this mental effort and have one sentence that covers all three components (initializer blocks, property initializers, and secondary constructors). Specifically, my suggestion is to add the italicized part to this sentence: “the code in all initializer blocks and property initializers is executed before the secondary constructor body.”
Or if you want to get fancy, then add a code example that covers all three components at the same time.