> This is a somewhat dubious feature borrowed from Matlab. I think we should > deprecate and then drop it. >
That furthermore does not work like the Matlab one ... but would be nice if it did > > > On Mon, Mar 24, 2014 at 11:01 PM, Sam L <[email protected] > <javascript:>>wrote: > >> 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.bcalls >>> 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 >>> >>> >>> >>> >>> >
