After some experimentation, it looks like second way takes a symbol or 
variable who's value is a symbol. 

julia> type MyType; a::Int; end

julia> x = MyType(3)
MyType(3)

julia> x.a
3

julia> x.(a)
ERROR: a not defined

julia> x.(:a)
3

julia> b = :a
:a

julia> x.(b)
3


On Monday, March 24, 2014 7:46:38 PM UTC-7, J Luis wrote:
>
> The doc of getfield says
>
> getfield(*value*, *name::Symbol*)
>
> Extract a named field from a value of composite type. The syntax a.b calls
> getfield(a, :b), and the syntax a.(b) calls getfield(a, b).
>
> but when I try the a.(b) variation, it errors (or it's me who errors?)
>
> julia> gmt_modules.write
> "<?I,>?O"
>
> julia> gmt_modules.(write)
> ERROR: type: getfield: expected Symbol, got Function
>
>
>
>
>

Reply via email to