JuliaPhysics / JuliaPhysics/Unitful.jl
Constructor should check that dimension and units are consistent
- Dominant language
- Julia
- Stars
- 675
- Forks
- 124
- Avg merge
- 3h 38m
- Merged PRs (30d)
- 1
Description
Right now, one can create a quantity that has units `s` (seconds, a time unit) but dimension `𝐋` (length) by just calling the constructor with those type parameters:
```julia
julia> using Unitful: Quantity, 𝐋, s
julia> x = Quantity{Int64, 𝐋, typeof(s)}(2)
2 s
julia> unit(x)
s
julia> dimension(x)
𝐋
julia> x isa Unitful.Length
true
julia> x isa Unitful.Time
false
julia> unit(x) isa Unitful.LengthUnits
false
julia> unit(x) isa Unitful.TimeUnits
true
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the Quantity constructor example from the issue and inspect the constructor's handling of its dimension and unit type parameters. Done means inconsistent parameters such as length with seconds are rejected, while consistent quantities remain constructible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100