My package, CliffordNumbers.jl, defines two functions:
CliffordNumbers.similar_type(::Type{C}, ::Type{T}, ::Val{Q}) where {C<:AbstractCliffordNumber,T<:Union{Real,Complex},Q}
constructs a type similar toC
but with type parametersT
andQ
in place of other type parameters ofC
(if they are present).CliffordNumbers.dot(x::AbstractCliffordNumber, y::AbstractCliffordNumber)
defines the dot product of two Clifford numbers.
You might notice that these functions have very similar functionality to StaticArrays.similar_type
and LinearAlgebra.dot
, and you are correct! These operations, to my knowledge, have entirely compatible semantics.
However, there’s a problem: CliffordNumbers.jl has no dependencies, not even LinearAlgebra, so exporting these names will conflict will cause name conflicts. For the moment, leaving CliffordNumbers.dot
unexported is OK, as the left/right contractions are preferred to the dot product. However, I’d like to export CliffordNumbers.similar_type
for the same reasons StaticArrays.jl does so.
The question is: is there any way to define and export CliffordNumbers.dot
and CliffordNumbers.similar_type
that will not conflict with the definitions of dot
and similar_type
in their respective packages, but also does not require me to take them as a hard dependency?
I am aware of this topic which discusses the problem of function merging at length, but I’m wondering if this is any different now that package extensions are a thing (last reply was in 2018). The key issue here is that CliffordNumbers.dot
and CliffordNumbers.similar_type
should be usable without loading either LinearAlgebra or StaticArrays.