-
Notifications
You must be signed in to change notification settings - Fork 554
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
consider removing/disallowing schema cycles #1049
Comments
hmmm 🤔 I see two different issues here: First: We could break these circular dependencies at the definition layer, but that seems a bit awkward - we'd be splitting up defs like Second & probably harder to resolve: One possible middleground solution would be to group all defs (not records/queries/procedures/subscriptions) in a single file & then have separate code-genned files for each of the higher order lexicons Thoughts? |
One possibility in this specific case might be to fold all the definitions from
This is potentially not hard to resolve AFAICS, by moving Here's a patch that demonstrates both possibilities (but it does move the In general, my experience with Go packages tells me that although avoiding cycles is a pain at times, the resulting acyclic dependency patterns are almost always better engineered and easier to understand, so it might well be worth sorting out/clarifying this issue while it's easy to do.
This doesn't seem like it would scale very well to me when there are an arbitrary number of namespaces around, because we might want to generate code for different namespaces in different, separately generated, modules, which precludes having a single unified view of all definitions in one place. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Currently a small number of the lexicons introduce cycles, a.k.a. circular dependencies.
This makes it awkward to generate code in languages such as Go which don't allow cyclic package dependencies.
One way to do it is to merge all lexicons into a single package, but that's not ideal:
keeping an isomorphism between lexicons and the generated code seems like a nice property.
Here's an itemized list of all the circular dependencies currently (as of commit e9ba4a7).
Each cycle is shown as a separate section. The indented parts show the actual definition-level dependencies.
It's possible to break the cycles with a three line change, although clearly that would break compatibility.
The text was updated successfully, but these errors were encountered: