Is there a current cleverness in TR that allows for typesafe avoidance of back patching a self referential structure. <div><br></div><div>Say one wants to construct a TOP-NODE where the parent field is itself. I know I could make parent : (Option Node) and back patch with a set!. But could one do better.</div>
<div><br></div><div>The below type checks but of course fails on execution. However some sort special post structure construction asserting "defined-ness" of the parent field triggered as a post operation after (atomic) structure creation assertion would get one there.</div>
<div><br></div><div><div>#lang typed/racket/base</div><div><br></div><div>(struct: Node ([parent : Node]))</div><div><br></div><div>(: TOP-NODE Node )</div><div>(define TOP-NODE</div><div> (letrec: ((self : Node (Node (assert self Node?))))</div>
<div> self))</div></div><div><br></div><div>;;;;;;;;;;</div><div><br></div><div> Anyway, just a random thought on a coffee break.</div><div><br></div>