Seen a couple examples of a recursive Schema and those have been tough enough to grok, but I seem to have gone further and have a co-recursive case. I have not seen that discussed, but please point me to where to look if I missed it.
Real case has about a dozen cases and I believe 3 pairwise co-recursions. Maybe it’s even worse than that as I have HelperText which contains Text and HelperText appears in some Components. Anyhow, let’s start with the reduced case and get to the bottom of the key concepts.
Compiles fine, but when I try to execute main (which simply prints the componentSchema to force the evaluation of the lazy value) I get an infinite loop.
- How does one debug this sort of infinite loop? I get what’s happening roughly, but not sure how to dig in to understand the details. e.g. would love to figure out where the auto derivation put the SRefs to try to break the cycles to see if the choices seem sane.
- What are the proper approaches to work through this as I expect to be making this a much larger case once we resolve this minimized recreation?
- I’ve tried writing the Schema by hand, but couldn’t get that quite right given the documents and posts I was able to find. I believe the key is where SRefs get inserted and would prefer to have auto derivation do that rather than doing it manually purely due to maintenance concerns. If you do think manual schema specification is the path forward, where are good resources for defining larger custom schemas and figuring out where to put the SRefs (is it simply max flow/min cut?)?
- Any way to cause the failure to occur at compile time to avoid runtime surprises?
Thank you in advance!
PS First time poster with small ego so open to feedback.