Skip to content
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

Detect circular references in DSL and provide a meaningful error message #292

Open
gene-pavlovsky opened this issue Jun 15, 2018 · 2 comments
Assignees

Comments

@gene-pavlovsky
Copy link

gene-pavlovsky commented Jun 15, 2018

Example code:

snapshotModule = new module.SnapshotModule(snapshotDependencies);
snapshotDependencies = new Array<hex.di.mapping.MappingDefinition>(
	mapping({fromType: "Void->Void", toValue: snapshotController.onSnapshotSaved, withName: "onSnapshotSaved"})
);
snapshotController = new adapter.SnapshotController(snapshotModule.takeSnapshot);

As you can see, there is a circular dependency between snapshotModule and snapshotController, but it might be hard to notice in some cases.
Trying to compile the code results in a really long list of errors, none of which are helpful to find the source of the problem.

It would be nice if circular dependencies are detected during building of the dependency graph, and a meaningful error message is produced.

@FrancisBourre
Copy link
Collaborator

This one is tricky (for the edge cases). I will have to think about it in details. Btw, I could develop a 1st iteration for the common ones.

@gene-pavlovsky
Copy link
Author

Yeah I know it's tricky :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants