-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
RFC: Give MethodMatch its own type #36702
Conversation
Yes I definitely like this. |
src/jltypes.c
Outdated
@@ -2383,6 +2384,11 @@ void jl_init_types(void) JL_GC_DISABLED | |||
jl_perm_symsvec(2, "typ", "fields"), | |||
jl_svec2(jl_any_type, jl_array_any_type), 0, 0, 2); | |||
|
|||
jl_method_match_type = jl_new_datatype(jl_symbol("MethodMatch"), core, jl_any_type, jl_emptysvec, | |||
jl_perm_symsvec(4, "metharg", "methsp", "method", "fully_covers"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we give these real words? (or at least the same mangling we do now):
signature
(or specTypes
), env
(or sparam_vals
), method
, <:
(or whatever this is)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what they were called in inlining. I agree we can pick better names. How about just specTypes
, sparams
, method
, fully_covers
? I don't like using <:
as a field name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about not mixing snake case and camel case? 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spec_types
then, though at some point we should also switch over MethodInstance
then.
5dfd35e
to
606cd91
Compare
Alright, this should be done now. |
Every time I see any code dealing with the svecs we get back from the method match code, I think that it shouldn't really be an svec: 1. It's always the same length 2. Basically every use of it typeasserts the field type 3. Every use of it needs the same magic numbers to access the fields. All put together this should just be a type. This updates all the uses accordingly, but adds fallback getindex/iterate defintions for external users that expect this to be a SimpleVector (in deprecated.jl - hopefully by 2.0 all external users will upgraded).
Every time I see any code dealing with the svecs we get back from the method match code, I think that it shouldn't really be an svec: 1. It's always the same length 2. Basically every use of it typeasserts the field type 3. Every use of it needs the same magic numbers to access the fields. All put together this should just be a type. This updates all the uses accordingly, but adds fallback getindex/iterate defintions for external users that expect this to be a SimpleVector (in deprecated.jl - hopefully by 2.0 all external users will upgraded).
Every time I see any code dealing with the svecs we get back from
the method match code, I think that it shouldn't really be an svec:
All put together this should just be a type. This basically does that,
but there's a few things missing, so before I go finish it, I figured,
I'd make sure that there isn't some reason not to do this.
TODO:
MethodMatch
to avoid breaking packages that use the internal APIDoesn't need extensive review in this state, since it isn't done,
just a quick yay/nay on the direction.