When applied to functions whose parameter types might be themselves parametric, it will not recreate the function signature with a union of types. Take the following example:
module M
using CxxWrap
@wrapmodule ...
__init__() = @initcxx
@cxxdereference f(::MyParametricType) = 42
end
If we now inspect the output of methods(f), we find something like the following:
julia> import M
julia> methods(M.f)
[1] f(::MyParametricType) in Main at M:1
The expected behavior would be to generate a Union of all possible value, reference, and smart pointer types for type MyParametric (e.g. Union{MyParametricType,CxxBaseRef{MyParametricType},SmartPtr{MyParametricType}).
Additionally, it would be interesting to explore the capability of, instead just the raw abstract type, include the parameter type, be it a generic type T or a concrete type. As a hypothetical, ake the following as a potential example:
julia> @cxxdereference g(::MyParametricType{T}) where T = 42
g (generic function with 1 method)
julia> methods(g)
[1] f(::Union{MyParametricType{T},CxxBaseRef{MyParametricType{T}},SmartPtr{MyParametricType{T}}) where T in Main at CxxWrap.jl:787
Currently, this is unfeasible since T falls into the macro as an undefined symbol. There is most likely a way of circumventing this by defining reference_type_union for parametric types, but I'm not so sure. The reason why I argue including the parametric type might be useful is because it is added information one may rely upon (I have a use case for this in which it helps that I know the parametric type within the function to get added information. Specifically, I recently mapped Voronoi_diagram_2 from CGAL as a parametric type, which takes in a triangulation. I'd like to know which triangulation I'm leading with to see what type of Point_2 it uses).
When applied to functions whose parameter types might be themselves parametric, it will not recreate the function signature with a union of types. Take the following example:
If we now inspect the output of
methods(f)
, we find something like the following:The expected behavior would be to generate a
Union
of all possible value, reference, and smart pointer types for typeMyParametric
(e.g.Union{MyParametricType,CxxBaseRef{MyParametricType},SmartPtr{MyParametricType}
).Additionally, it would be interesting to explore the capability of, instead just the raw abstract type, include the parameter type, be it a generic type
T
or a concrete type. As a hypothetical, ake the following as a potential example:Currently, this is unfeasible since
T
falls into the macro as an undefined symbol. There is most likely a way of circumventing this by definingreference_type_union
for parametric types, but I'm not so sure. The reason why I argue including the parametric type might be useful is because it is added information one may rely upon (I have a use case for this in which it helps that I know the parametric type within the function to get added information. Specifically, I recently mappedVoronoi_diagram_2
from CGAL as a parametric type, which takes in a triangulation. I'd like to know which triangulation I'm leading with to see what type ofPoint_2
it uses).