In CliffordNumbers.jl, Base.reverse implements the reverse operation on a Clifford number or indexing object (BitIndex). For convenience, I’ve also overloaded the adjoint operator '.
Because the documentation for adjoint(::BitIndex) and reverse(::BitIndex) are identical, I’ve used to @doc macro to apply the original docstring to reverse(::BitIndex):
"""
adjoint(i::BitIndex) = reverse(i::BitIndex) = i' -> BitIndex
adjoint(x::AbstractCliffordNumber) = reverse(x::AbstractCliffordNumber) = x' -> typeof(x)
Performs the reverse operation on the basis blade indexed by `b` or the Clifford number `x`. The
sign of the reverse depends on the grade of the basis blade `g`, and is positive for `g % 4 in 0:1`
and negative for `g % 4 in 2:3`.
"""
adjoint(i::BitIndex) = typeof(i)(xor(signbit(i), !iszero(grade(i) & 2)), UInt(i))
reverse(i::BitIndex) = adjoint(i)
@doc (@doc adjoint(::BitIndex)) reverse(::BitIndex)
This worked fine until 1.11 dropped, and now I face two problems:
- Accessing help for
reversefrom the REPL now includes docstrings for all of the documented methods ofadjoint/the'operator, not justadjoint(::BitIndex). - Documenter.jl does not think that I’ve actually documented the method
reverse(::BitIndex).
I assume the behavior of @doc has changed Is the way I’m doing things a hack that I shouldn’t be using? I’d like a more robust way to reuse docstrings if possible.