Irrational numbers are unique, so which package gets to define them?

While Base uses a symbol for the type parameter, this is merely a convention. You can define your own type (possibly parametrizing it by a symbol, too) and use that as a parameter. Eg

struct MyIrrational{T} end

Base.Float64(::Irrational{MyIrrational{:sqrt2}}) = √2

From that point on, just avoid type piracy and you will be fine.

4 Likes