From 56121c18b9286448d32886876a6a6d13c4264f70 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 6 Jun 2024 15:41:36 +0200 Subject: [PATCH] Mention @wrap changes --- CHANGES.md | 2 ++ src/macros.jl | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index aa704138c..589120aa4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,8 @@ - Allow `GapInt(x)` as shorthand for producing a GAP integer - Show an error when trying to load GAP.jl while multithreaded GC is enabled - Support `gap_to_julia(::AbstractVector)` +- Enhance `@wrap` so that it can produce wrapper functions which coerce + arguments to GAP objects (see its docstring for details and examples) - Various janitorial changes ## Version 0.11.0 (released 2024-04-05) diff --git a/src/macros.jl b/src/macros.jl index 79d2c9833..02a2ad305 100644 --- a/src/macros.jl +++ b/src/macros.jl @@ -328,8 +328,9 @@ However, the generated function actually caches the GAP object `GAP.Globals.NAME This minimizes the call overhead. So @wrap typically is used to provide an optimized way to call certain GAP functions. -If an argument is annotated as `::GapObj`, the resulting function accepts arguments -of any type and wraps them in `GapObj(...)` before passing them to the GAP function. +If an argument is annotated as `::GapObj` (respectively `::GAP.Obj` or `::GapInt`), +the resulting function accepts arguments of any type and attempts to convert them +to `GapObj` (respectively `GAP.Obj` or `GapInt`) before passing them to the GAP function. Another use case for this macro is to improve type stability of code calling into GAP, via the type annotations for the arguments and return value contained in the