Capture returned string from show


I want to capture the returned string from a dispatched show function on my customized type, but somehow it always returns an empty string:

struct MyType

a = MyType(), ::MyType) = println("hello")

b = repr(a) # b == ""

What should be the right way to this?

This should be println(io, "hello").