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

Enhance GAP.@wrap and GAP.@gapattribute macros #3720

Open
fingolfin opened this issue May 13, 2024 · 2 comments
Open

Enhance GAP.@wrap and GAP.@gapattribute macros #3720

fingolfin opened this issue May 13, 2024 · 2 comments
Labels

Comments

@fingolfin
Copy link
Member

fingolfin commented May 13, 2024

  1. For @gapwrap we could teach it to auto-convert arguments to GapObj if necessary. So for example, if we have

    GAP.@wrap IsCyclic(x::GapObj)::Bool

    then the funtion this generates could be made equivalent to the following (ignoring for simplicity of the argument the optimizations performed by GAP.@wrap):

    IsCyclic(x::Any) = GAP.Globals.IsCyclic(GapObj(x))::Bool

    Note that it inserted GapObj(x) instead of x to force the argument to be a GapObj. Of course if the argument type is something different, e.g. ::Any we don't need this. (We can discuss what to do about other types like e.g. GAPInt or GAP.Obj, but these are less common)

  2. For @gapattribute we could add a variant of this macro to Oscar which checks for GAPWrap instead of (or in addition to) GAP.Globals, so that we can rewrite

    @gapattribute is_cyclic(G::GAPGroup) = GAP.Globals.IsCyclic(GapObj(G))::Bool

    as something like this (the ::Bool is now redundant as the IsCyclic wrapper already has it)

    @gapattribute is_cyclic(G::GAPGroup) = GAPWrap.IsCyclic(GapObj(G))

    or indeed, when combined with the changes to the @wrap macro, to

    @gapattribute is_cyclic(G::GAPGroup) = GAPWrap.IsCyclic(G)
@lgoettgens

This comment was marked as resolved.

@fingolfin

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants