Many thanks guys, that is exactly what i was looking for!
Attaching my version for anyone intersted.

type myType
   myName::Int
   myValue::String
end

function echoFields(io::IO, theInst)
   print ("{")
   fieldList = names(typeof(theInst))
   for i = 1:length(fieldList)
fieldName = fieldList[i]
   if i!=length(fieldList)
       print(fieldName, "=", getfield(theInst,fieldName), " ")
else
       print(fieldName, "=", getfield(theInst,fieldName))
end
   end
   print ("}")
end

Base.show(io::IO, www::myType) = echoFields(io,www)

d = Dict{Int, myType}()
d[1] = myType(1, "AAA")
d[3] = myType(3, "BBB")
d[7] = myType(5, "CCC")

println(d)

Reply via email to