Skip to content

Commit

Permalink
remove unbound type parameter
Browse files Browse the repository at this point in the history
Unbound type parameters often cause performance issues and run time
dispatch.

Issue found using JuliaLang/julia#46608
  • Loading branch information
nsajko committed Sep 9, 2022
1 parent df911c5 commit 200b4e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/NamedTupleTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ end
return (; zip(namesforvalues, valuesfornames)...,)
end

namedtuple(namesforvalues::Vector{S}, valuesfornames) where {N,S<:AbstractString} =
namedtuple(namesforvalues::Vector{S}, valuesfornames) where {S<:AbstractString} =
namedtuple(Symbol.(namesforvalues), valuesfornames)

namedtuple(namesforvalues::NTuple{N,S}, valuesfornames) where {N,S<:AbstractString} =
Expand Down Expand Up @@ -257,7 +257,7 @@ delete(a::NamedTuple, bs::Vararg{Symbol}) = Base.structdiff(a, namedtuple(bs))

delete(::Type{T}, b::Symbol) where {S,T<:NamedTuple{S}} = namedtuple((Base.setdiff(S,(b,))...,))
delete(::Type{T}, b::NTuple{N,Symbol}) where {S,N,T<:NamedTuple{S}} = namedtuple((Base.setdiff(S,b)...,))
delete(::Type{T}, bs::Vararg{Symbol}) where {S,N,T<:NamedTuple{S}} = namedtuple((Base.setdiff(S,bs)...,))
delete(::Type{T}, bs::Vararg{Symbol,N}) where {S,N,T<:NamedTuple{S}} = namedtuple((Base.setdiff(S,bs)...,))

"""
select(namedtuple, symbol(s)|Tuple)
Expand Down

0 comments on commit 200b4e6

Please sign in to comment.