How do I extend Base's @show macro to my own types?
Example:
struct friendly
string
end
Base.show(f::friendly) = f.string * " :)"
p = friendly("people")
And then calling show(p) returns:
"people :)"
But @show p just does the normal thing (notebook result):
p = friendly("people")
friendly("people")
I tried extending the macro from base:
Base.@show(f::friendly) = f.string * " :)"
But that errors with:
syntax: invalid assignment location "begin
Base.println("f::friendly = ", Base.repr(begin
# show.jl, line 576
#105#value = f::friendly
end))
#105#value
end"
Stacktrace:
[1] top-level scope at C:\Users\User\.julia\packages\IJulia\cwvsj\src\kernel.jl:52