I have a question concerning the overloading of operators for an own type

In our package on manifolds, we also cover Lie groups. These have an identity element (see Manifolds.jl/group.jl at 7e90c455804311f1220bcb52878fa5abf86e0abb · JuliaManifolds/Manifolds.jl · GitHub) where we parametrise it by the group under consideration.

Usually we do not type our group elements, since we want to be open for other types. We usually think of matrices representing a point on the manifold, but other types are welcome, too.

Now when overloading operators (e.g. `isapprox`

, but more prominently `+`

,`-`

or `*`

,`/`

- depending on the group action) we have definitions like (see Manifolds.jl/group.jl at 7e90c455804311f1220bcb52878fa5abf86e0abb · JuliaManifolds/Manifolds.jl · GitHub).

```
Base.:+(e::Identity{G}) where {G<:AdditionGroup} = e
Base.:+(p::Identity{G}, ::Identity{G}) where {G<:AdditionGroup} = p
Base.:+(::Identity{G}, p) where {G<:AdditionGroup} = p
Base.:+(p, ::Identity{G}) where {G<:AdditionGroup} = p
Base.:+(e::E, ::E) where {G<:AdditionGroup,E<:Identity{G}} = e
```

- How can I avoid ambiguities with other packages that also define a + this way, for example if we would like to use ChainRules (ChainRulesCore.jl/differential_arithmetic.jl at 22c7bc368354428f0b62c350f1301e24e5644922 · JuliaDiff/ChainRulesCore.jl · GitHub)?

I am not sure what the implications of this ambiguity (so whether it is important to resolve this) are and how often these appear - One possible ambiguity might appear if one
`+`

es two identities from different groups. This is not a valid operation. Would it be reasonable to provide a proper error message instead of the (very vague) Ambiguous error one would get?

Is there some coding style / good practice for these?