Summary
It seems that interfaces using default implementations with reference type members propagate the same reference to all implementors.
string_reference <public> := class:
var String : string = ""
foo <public> := interface<unique>:
ExampleEvent <public> : event(string) = event(string){}
StringReference <public> : string_reference = string_reference{}
bar <public> := class(foo):
Initialize()<suspends>:void=
var i : int = 0
loop:
Sleep(1.0)
set i += 1
set StringReference.String = "{i}"
ExampleEvent.Signal("bar {i}")
baz <public> := class(foo):
Initialize()<suspends>:void=
sync:
block:
loop:
Sleep(1.0)
Print(StringReference.String) # Prints whatever was set in bar
block:
loop:
String := ExampleEvent.Await()
Print(String) #Prints bar.
Please select what you are reporting on:
Creative
What Type of Bug are you experiencing?
Assets
Steps to Reproduce
Copy code snippet, call bar.Initialize() and baz.Initialize() in a creative_device or component’s <suspends> entry point.
Expected Result
a new reference type instantiated per implementor
Observed Result
unexpected global state / behavior
Platform(s)
Windows