JuliaCollections / JuliaCollections/DataStructures.jl
Should DefaultDict{K,V} without default value specified have a fallback?
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 745
- Forks
- 261
- PR merge metrics
- No merged PRs in 30d
Description
Right now we have:
I wonder if we shouldn't fall back to calling the value type with a zero arg constructor.
DefaultDict{K,V}() = DefaultDict{K,V}(V())
This would work well for Vector which is my most common use case for DefaultDicts/
Maybe for numbers we should default to zero, though this is stepping on the grounds of Accumulator
DefaultDict{K,V}() where V<:Number = DefaultDict{K,V}(zero(V))
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read src/default_dict.jl around line 122 and review the existing DefaultDict constructors. Resolve whether an unspecified default should call V(), use zero for numeric types, or follow another rule, then define the expected behavior and tests before implementing it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100