How to overload operators and their doc bindings

Note that the help does not work even with the standard <:

help?> Main.<
search:

Couldn't find Main.<
Perhaps you meant Main or Matrix
  No documentation found.

  Binding Main.< does not exist.

Thus, not answering exactly that question, there are two things: Using Foo.< as as that would be very inconvenient if you do not export < from your module.

Yet, if you want to export it, you are probably wanting to overload the Base.<, and in that case you should that explicitly:

julia> module Foo
          
           struct Point
               x::Int
               y::Int
           end
           
           import Base: <  # import here
           """
               <(a::Point, b::Point) -> Bool
               
           Compare two `Point`s object.
           """
           function <(a::Point, b::Point)
               a.x < b.x || a.y < b.y || (a.x == b.x) && (a.y < b.y)
           end
       end
WARNING: replacing module Foo.
Main.Foo

with which < works for your points:

julia> x = Foo.Point(1,1); y = Foo.Point(2,2);

julia> x < y
true

and the help entry appears when typing ? < (among the other definitions for <):


  <(a::Point, b::Point) -> Bool

  Compare two Points object.