hi,
I've got a type and I want to be able to update certain fields of the type 
under the restriction that I don't know when I will be changing with field 
- i.e. I want to be able to do someting like the following. take the 
example type tt with 2 fields, a and b, and a dict "newval" that contains 
new values for both fields. I want to iterate over newval, and put 
newval[j] in tt.j. how can I do this? Here's how far I got.

type tt 
a ::Int
b ::Int
end

function update(x::tt,newval::Dict)
dnames = collect(keys(newval))
for nm in dnames
eval(parse("x.$nm = newval[$nm]")) 
end
return x
end
thanks!

Reply via email to