Summary
In verse, a block: inside of a class typically runs when the object is executed. If you construct the object using a constructor called within another constructor, it will not execute.
Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
Verse
Steps to Reproduce
Here is an example code snippet
class_a := class:
block:
Print("Hello from Class A block")
class_b := class:
ClassA: class_a
block:
Print("Hello from Class B block")
ConstructClassA<constructor>() := class_a{}
ConstructClassBWithInnerConstructor<constructor>() := class_b:
ClassA := ConstructClassA()
ConstructClassBWithClassAAsArg<constructor>(ClassA: class_a) := class_b:
ClassA := ClassA
constructor_bug_repro<public> := class(creative_device):
OnBegin<override>():void =
Print("Constructing Class B with Inner Class A Constructor")
ClassB1 := ConstructClassBWithInnerConstructor()
Print("Constructing Class B with Class A as an argument")
ConstructClassBWithClassAAsArg(ConstructClassA())
Expected Result
Expected Output:
<#
[26614.93][470]LogVerse: : Constructing Class B with Inner Class A Constructor
[26614.93][470]LogVerse: : Hello from Class A block
[26614.93][470]LogVerse: : Hello from Class B block
[26614.93][470]LogVerse: : Constructing Class B with Class A as an argument
[26614.93][470]LogVerse: : Hello from Class A block
[26614.93][470]LogVerse: : Hello from Class B block
#>
Observed Result
Observed Output:
<#
[26614.93][470]LogVerse: : Constructing Class B with Inner Class A Constructor
[26614.93][470]LogVerse: : Hello from Class B block
[26614.93][470]LogVerse: : Constructing Class B with Class A as an argument
[26614.93][470]LogVerse: : Hello from Class A block
[26614.93][470]LogVerse: : Hello from Class B block
#>
Platform(s)
All