Seshat's Gambit currently relies on the interior mutability behaviour of FrameForEach.acc to pop the iota from the accumulator:
|
val accumulator = frame.acc |
|
if (accumulator.isNotEmpty()){ |
|
output = accumulator.removeLast() |
|
} |
While this currently works, it will break in the next Hex Casting patch, since we're switching Thoth to use an immutable TreeList internally in FallingColors/HexMod#1031.
To ensure it still works as documented after this patch, OpThothYoink should instead use frame.copy() to copy the frame construct a new FrameForEach (frame.copy() won't work - acc will no longer be a dataclass field) with an updated version of the accumulator, and create a new continuation with the frame replaced.
Seshat's Gambit currently relies on the interior mutability behaviour of
FrameForEach.accto pop the iota from the accumulator:Ephemera/common/src/main/java/net/beholderface/ephemera/casting/patterns/OpThothYoink.kt
Lines 24 to 27 in 1faefe4
While this currently works, it will break in the next Hex Casting patch, since we're switching Thoth to use an immutable TreeList internally in FallingColors/HexMod#1031.
To ensure it still works as documented after this patch, OpThothYoink should instead
useconstruct a new FrameForEach (frame.copy()to copy the frameframe.copy()won't work -accwill no longer be a dataclass field) with an updated version of the accumulator, and create a new continuation with the frame replaced.