JuliaPhysics / JuliaPhysics/DynamicQuantities.jl

Immutable constants for symbolic dimensions

Open
#60 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
155
Forks
32
PR merge metrics
No merged PRs in 30d

Description

Right now the units and constants for symbolic dimensions, like the one you get from `us"km"`, are stored with mutable arrays (note that non-symbolic versions like `u"km"` are fine as-is).

This is part of the reason it takes so long to generate all of the constants, which is why they are created at first call to `sym_uparse`, rather than at precompilation time. This is why the first time you call `us"km"`, it takes a little longer. It's also why you can't precompile things with symbolic dimensions (see #58).

I think it might make sense instead to have an immutable version of each of the symbolic units and constants. I'm not quite sure how this would work. Maybe you could have another `SymbolicImmutableDimensions <: AbstractDimensions` that is explicitly for storing symbolic dimensions constants, and stores the symbol.

Then you could have promotion rules set up so it will convert itself to `SymbolicDimensions` when operated on. But maybe there is a simpler way.

Thoughts @gaurav-arya @devmotion?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.