Dear all,

This is somewhat the following of a previous topic: 
https://groups.google.com/forum/#!topic/julia-users/CvQMwq2rN9I but since 
the two issues have little in common, I thought it was better to create a 
new topic.

I'd like to access the members of a type via a string, i.e. if I define:

type parameters
    p1::Float64
    p2::Float64
    p3::Float64
end

p = parameters(3.6, 0.6, 600.0)

label = "p1"

is there a way to access p.p1 through something like:

p.names(label)

I guess this has to do with reflection in julia. I know there is a way to 
get the names through

names(p)

but there's nothing in the documentation about what I'm looking for. I did 
some research and I came across this reflection.jl file: 
https://github.com/JuliaLang/julia/blob/master/base/reflection.jl that I 
tried to decypher, but with little success. (Incidentally, I'd be 
interested in understanding what happens here if there's some resource 
helping to do so.)

Thanks a lot,

AS

Reply via email to