How to change the value of a composite type field using Symbol or String ?
Example: if I have MyType ,
type MyType x end mt=MyType(0)
I know that I can change the value to mt.x=1 .
However, how can I do the same using the variable changed_fieldname = :x or changed_fieldname = x ?
I do not want to write the field name directly as mt.x=1 .
sholi source share