The following code (from here)
Base.getproperty(d::Dict, s::Symbol) = s ∈ fieldnames(Dict) ? getfield(d, s) : getindex(d, s)
makes a dictionary key symbols accessible like a struct fields, i.e.
julia> D = Dict(:a=>1,:x=>1.1,:arr=>[1,2,3],"str"=>2) julia> D.x 1.1
However within REPL
julia> getfield(D,:x) ERROR: type Dict has no field x ...
I want to understand why getfield(D,:x) does not work while it is working in the method implementation of Base.getproperty?