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

Resolve glob filters as late as possible and throw warning instead of error if not applicable #1818

Open
dunkelziffer opened this issue Jan 28, 2024 · 0 comments

Comments

@dunkelziffer
Copy link

Glob filters are less composeable with other concepts from D2, namely imports and classes, than I had hoped. This seems to be due to 2 reasons:

  • D2's parsing/resolution order seems different than what I expected
  • a non-applicable filter raises an error instead of getting ignored with a warning (actually violates your design decisions)

I already stumbled upon that in #1724, but I wanted to make an explicit ticket for this now, so it's not hidden within a completely unrelated topic anymore.

I haven't looked at the implementation of D2. Personally, I would have expected the first step to be resolving imports. However, the documentation section about global globs makes me wonder, whether that is actually true. If global globs work across imports, then nested globs don't. So if we resolve the imports first, how would the nested globs know, where to stop?

But this leads to a problem. If we resolve globs before imports, we probably also need to resolve glob filters at that stage. This makes glob filters less modular.

Could we split the glob handling into two phases?

  • glob handling phase 1: select potential candidates (disregarding filters, respecting import boundaries)
  • resolve imports
  • resolve classes
  • glob handling phase 2: select actual candidates (respecting filters that were added later by imports and classes)
@cyborg-ts cyborg-ts added this to D2 Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant