If it’s just for debugging one’s own library I think it could be helpful to have a configurable type alias system in Cthulhu’s outputs. Julia’s type system is the best I’ve encountered in any language, but it can admittedly get a bit verbose at times. Especially as some types stretch over the VSCode length limit in the Cthulhu labels and end up missing some information.
If the user could tweak union aliases in Cthulhu, it might also be useful to allow declaration of preferred abbreviations like Float32
→ F32
, Tuple
→ Tu
, etc, just to make the printouts less verbose. Again, this is just Cthulhu/JET/etc, this is not a suggestion for all of Julia, don’t worry
Maybe like
import Cthulhu: type_string
# default used in package:
# type_string(t) = string(t)
# user aliases:
type_string(::Type{Float32}) = "F32"
type_string(::Type{Union{A,B}}) where {A,B} = "(" * type_string(A) * "|" * type_string(B) * ")"
# etc.
which you could toss in your startup.jl
Aside: I’m also curious how, in a startup file, one could override printing globally for Union{A,B}
→ (A|B)
? It’s obviously type piracy and subjective (and I wouldn’t advise for a package to do this) but if you are using infix unions in code anyways, it could be useful to also override printing locally. (Since you would presumably be able to copy-paste the outputs if you’ve already defined that alias on your system).