Tamas Papp
unread,May 1, 2015, 9:57:22 AM5/1/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia-dev
Hi,
I thought I would ask before reporting as a bug.
If isa(T, DataType) but !Base.isstructtype(T), is fieldnames(T) supposed
to return an empty vector or throw an error?
Currently (v"0.4.0-dev+4524") the first one happens:
julia> fieldnames(Real)
0-element Array{Symbol,1}
julia> fieldnames(Float64)
0-element Array{Symbol,1}
But the error message in the code
function fieldnames(v)
t = typeof(v)
if !isa(t,DataType)
throw(ArgumentError("cannot call fieldnames() on a non-composite type"))
end
return fieldnames(t)
end
suggests that this is not what is supposed to happen. Would submit a PR,
but I need to wrap my head around variations of DataType and how to
interpret the fields. Would it make sense to extend the type hierarchy
with something like
CompositeType <: DataType
MutableType <: CompositeType
ImmutableType <: DataType
AbstractType <: DataType
?
Best,
Tamas