Actually, using dynamic dispatch forces a chicken and egg situation, as I want
the dynamic dispatch method to construct (from JSON) the thing it is switching
on!
The following represents my conundrum:
method foo(s: SpecialisedTA, node: JsonNode) =
s.abc = node["abc"].getStr()
method foo(s: SpecialisedTB, node: JsonNode) =
s.def = node["def"].getStr()
var a: SpecialisedTA
foo(a, jsonNode)
Run
As expected, I am getting compiler cannot prove that 'r' is initialised, which
makes sense.
I think my only option is to change the builders from methods to named procs.