Perhaps it's related to the fact that `getfield` takes a `Symbol` argument:



julia> type MyType 
   b 
end 

julia> a = MyType(10) 
MyType(10) 

julia> getfield(a, :b) 
10

So you could just do `getfield(x, $(rhs.arg[2]))`.

On Sunday, July 26, 2015 at 6:00:58 PM UTC-4, Cedric St-Jean wrote:
>
> Why is . non-symmetric in a and b?
>
> > :(a.b).args
>
> 2-element Array{Any,1}:
>  :a   
>  :(:b)
>
>
> The second argument is a quotenode, how am I supposed to get to the :b 
> inside it? eval works, but in the Lisp world, that was bad style. I've 
> got a macro that works on this expression, and instead of 
> x.$(rhs.arg[2])
>
> I have to write
>
> x.$(eval(rhs.arg[2])
>
> Cédric
>

Reply via email to