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

serialization of more group attributes #4193

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ThomasBreuer
Copy link
Member

The idea is to implement serializations directly for the underlying GAP objects, instead of implementing them for the Oscar objects.

For boolean and numeric attributes, the two alternatives do not really differ, but for attributes whose values are themselves groups, for example center(g), we can simply serialize GAP.Globals.Center(GapObj(g)), together with its attributes, instead of first creating center(g) anew and then serializing its first component.

Another advantage is that this way, it will be easier to deal with "Oscar attributes" of groups that do not rely on GAP's attribute mechanism.

(The serialization of permutation groups gets changed with this approach; if we proceed like this then a fallback must be provided, in order to deal with the deserialization of files containing permutation groups that were serialized with the old method.)

Currently there is a problem with cyclic references, and the handling of attribute values that are GAP lists is not yet supported.

Here is an example for the cyclic reference problem:

julia> g = small_group(4, 1);

julia> path = mktempdir();  filenamev = joinpath(path, "v");

julia> save(filenamev, g)

julia> Oscar.reset_global_serializer_state();

julia> loadedv = load(filenamev);

julia> has_center(g)
false

julia> center(g);

julia> save(filenamev, g)

julia> Oscar.reset_global_serializer_state()
Dict{Base.UUID, Any}()

julia> loadedv = load(filenamev)
Internal error: encountered unexpected error during compilation of showerror:
StackOverflowError()

The idea is to implement serializations directly for the underlying GAP objects,
instead of implementing them for the Oscar objects.

For boolean and numeric attributes, the two alternatives do not really differ,
but for attributes whose values are themselves groups, for example `center(g)`,
we can simply serialize `GAP.Globals.Center(GapObj(g))`, together
with its attributes, instead of first creating `center(g)` anew
and then serializing its first component.

Another advantage is that this way, it will be easier to deal with
"Oscar attributes" of groups that do not rely on GAP's attribute mechanism.

(The serialization of permutation groups gets changed with this approach;
if we proceed like this then a fallback must be provided, in order to deal
with the deserialization of files containing permutation groups that were
serialized with the old method.)

Currently there is a problem with cyclic references, and the handling of
attribute values that are GAP lists is not yet supported.

Here is an example for the cyclic reference problem:
```
julia> g = small_group(4, 1);

julia> path = mktempdir();  filenamev = joinpath(path, "v");

julia> save(filenamev, g)

julia> Oscar.reset_global_serializer_state();

julia> loadedv = load(filenamev);

julia> has_center(g)
false

julia> center(g);

julia> save(filenamev, g)

julia> Oscar.reset_global_serializer_state()
Dict{Base.UUID, Any}()

julia> loadedv = load(filenamev)
Internal error: encountered unexpected error during compilation of showerror:
StackOverflowError()
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants