You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's not something that we have found a hard requirement for yet, but it is something that has come up once or twice for a friend that it's not possible to derive HasSchema for a recursive type. I.e.
structExpr{Vec(Vec<Expr>),String(String),None,}
The issue is with the first variant in which Expr references Expr. In the schema derive, we want to then find out the schema of Expr and stick it in the Vec<Expr>, but the problem is that we're in the middle of actively building the Expr schema. This causes an infinite loop of trying to build the schema of Expr so we can build the schema Expr and so on.
One possible solution would be to have something like a self or parent placeholder so that the schema could refer to it's own schema, but I'm not actually sure if that works or not.
Another interesting idea in a related dilemma for content-addressed self-referentiality is this one here:
It's not something that we have found a hard requirement for yet, but it is something that has come up once or twice for a friend that it's not possible to derive
HasSchema
for a recursive type. I.e.The issue is with the first variant in which
Expr
referencesExpr
. In the schema derive, we want to then find out the schema ofExpr
and stick it in theVec<Expr>
, but the problem is that we're in the middle of actively building theExpr
schema. This causes an infinite loop of trying to build the schema ofExpr
so we can build the schemaExpr
and so on.One possible solution would be to have something like a
self
orparent
placeholder so that the schema could refer to it's own schema, but I'm not actually sure if that works or not.Another interesting idea in a related dilemma for content-addressed self-referentiality is this one here:
https://whtwnd.com/makoconstruct.bsky.social/3lcdzw5oqh62t
It could work, but I haven't thought all the way through it. I just wanted to drop it here so it isn't forgotten.
Summary of the idea from that post:
The text was updated successfully, but these errors were encountered: