have a look at
http://docs.julialang.org/en/release-0.2/stdlib/base/#reflection

This works
MyType.names
MyType.types

there is also the names function.  Don't know if there is a
corresponding 'types' function.  Incidentally names also list all names
defined in a module.

On Sat, 2014-03-01 at 08:27, [email protected] wrote:
> Hi,
>
> Is there a way to extract the names and types of the fields in a given 
> composite type? 
>
> Say:
>
> type MyType
>      a::Int
> end
>
> Is there a way to get the field 'a', and the type of the field Int? I think 
> I've seen a way to get the type in the manual but not the name assigned to 
> the field.
>
> And also how do I list all the types defined in a module? I'm planning on 
> attempting to use Julia's metaprogramming features for a task where I need 
> to know these things.
>
> Thanks,
> Ben.

Reply via email to