To define a set of Regxx types,It would be OK with these pieces of code:
for (bits,t) in [(8,UInt8),(16,UInt16),(32,UInt32)]
rname = Symbol("Reg",bits)
@eval struct $rname
addr::UInt32
data::$t
end
end
But I wonder if there is any way to define types like this:
for bits in [8,16,32]
name = Symbol("D",bits)
@eval struct $name
addr::UInt32
data:: ??? # needs to produce UInt8、UInt16、UInt32
end
end