-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Allow Kind
s to be registered by packages outside JuliaSyntax
#461
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #461 +/- ##
==========================================
- Coverage 96.43% 95.69% -0.74%
==========================================
Files 14 13 -1
Lines 4208 3973 -235
==========================================
- Hits 4058 3802 -256
- Misses 150 171 +21 ☔ View full report in Codecov by Sentry. |
Ok codecov, you are partly right I forgot to cover some obscure error pathways for this obscure feature :-/ |
Extensible kinds are quite tricky. We want * To use a small number of bits for them * To have the string representation in the source, but have the compiler able to fully inline the integer representation. * Allow modules with different kinds to cooperate together on the same integer representation. * Not trigger invalidation when new kinds are added * Different `Kind` modules to not require cooperation This is a very hard set of constraints to satisfy. The last one is already impossible in a single flat namespace so in this design we've given up on it and require cooperation between all kind extension modules, including module authors allocating non-colliding id's for their modules, in addition to non-colliding kind names.
ebea012
to
e8609e9
Compare
Let's go with this. I don't love it. But I've thought a lot about a better solution and haven't found one so far. |
Chatted to @JeffBezanson about this - I think his opinion was roughly
Sorry Jeff 😂 For what it's worth, I tried other options and they also were bad! To explain a few things about how this implementation is one of the less terrible options:
One thing which is currently rather bad about this implementation (in light of the very recent juliac work from JuliaCon) is that we do have significant code in I'm not sure what the long term plan for this should be. For now I still think it's an improvement from the previous status quo and can be an internal API I guess. |
Extensible kinds are quite tricky. We want
Kind
modules to not require cooperationThis is a very hard set of constraints to satisfy. The last one is already impossible in a single flat namespace so in this design we've given up on it and require cooperation between all kind extension modules, including module authors allocating non-colliding id's for their modules, in addition to non-colliding kind names.
Why do we need this? It's very convenient for JuliaLowering to extend the set of
Kind
s, rather than needing to clone/convertKind
just to add a few lowering-specific forms.