-
Notifications
You must be signed in to change notification settings - Fork 134
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
Serialization Refactor #4162
base: master
Are you sure you want to change the base?
Serialization Refactor #4162
Conversation
02b2191
to
d758fad
Compare
47e3f3f
to
66a5f2e
Compare
Thanks @antonydellavecchia. |
src/Serialization/LieTheory.jl
Outdated
@@ -112,36 +93,27 @@ end | |||
|
|||
@register_serialization_type WeylGroup uses_id | |||
|
|||
type_params(W::WeylGroup) = WeylGroup, root_system(W) |
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.
Stupid question maybe: It seems to me that the first return value of type_params
is always the argument type. Is this a correct observation?
If yes, wouldn't it be possible to refactor that away into the calling function, so that type_params
loses the first return value? Imo, this could make the code a bit more readable. If there is a reason for this, I am happy to learn about it
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.
maybe there is a way to get a round it, but it was the only way I found I could get the new save_type_params
to work. See main.jl
src/Serialization/main.jl
Outdated
save_data_dict(s, :attrs) do | ||
for attr in attrs_list(s, T) | ||
has_attribute(obj, attr) && save_typed_object(s, get_attribute(obj, attr), attr) | ||
save_type_params(s::SerializerState, obj::Any) = save_type_params(s, type_params(obj)...) |
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.
save_type_params(s::SerializerState, obj::Any) = save_type_params(s, type_params(obj)...) | |
save_type_params(s::SerializerState, obj::Any) = save_type_params(s, typeof(obj), type_params(obj)...) |
I think this could do the trick
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.
yes this is probably fine
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.
actually, a little trickier than expected, there is an issue with the containers.
I'll have to dig deeper, but I dont have time now
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.
I've pushed a fix for this now
af1675c
to
215e946
Compare
Refactor serialization to use a new function called
type_params
which helps build a stack of type dependencies which will allow for serializing type information before the data.