Skip to content

Commit

Permalink
common case first
Browse files Browse the repository at this point in the history
  • Loading branch information
nsajko committed Jul 30, 2024
1 parent 6cf3b9c commit 233e4c8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions base/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ end
Get the name of field `i` of a `DataType`.
The return type is `Int` (the index of the field) for `x <: Tuple`, otherwise the return type is `Symbol`.
The return type is `Symbol`, except when `x <: Tuple`, in which case the index of the field is returned, of type `Int`.
# Examples
```jldoctest
Expand Down Expand Up @@ -251,7 +251,8 @@ fieldname(t::Type{<:Tuple}, i::Integer) =
Get a tuple with the names of the fields of a `DataType`.
For a tuple type, each name is an `Int` (the index of the field), otherwise it is a `Symbol`.
Each name is a `Symbol`, except when `x <: Tuple`, in which case each name (actually the
index of the field) is an `Int`.
See also [`propertynames`](@ref), [`hasfield`](@ref).
Expand Down

0 comments on commit 233e4c8

Please sign in to comment.