I want to pretty-print the representation of a value of a generic type T.
In Ruby, I would use 'pp':

    value = 'hello'
    pp value  # prints "hello" - with quotes!
    value = 42
    pp value  # prints 42

Now, value.to!string eliminates the quotes, should value be of type string. As a workaround, I put the value into an array to make use of the "undocumented" function formatElement:

    "%(%s%)".format([value])

Ugly! Where does Phobos hide the function I'm looking for?

Reply via email to