-
Notifications
You must be signed in to change notification settings - Fork 32
Description
I see you're planning several possible breaking changes here, so here's another breaking idea.
I've got a package, TypeDomainNaturalNumbers.jl, which makes it possible to describe number sets like "the nonnegative integers" using Julia's type system: https://juliahub.com/ui/Packages/General/TypeDomainNaturalNumbers/
This would be useful here for giving the "number of fraction bits" type parameter of FixedPoint
a type constraint, for greater type safety:
abstract type FixedPoint{T <: Integer, f} <: Real end |
abstract type FixedPoint{T <: Integer, f <: NonnegativeInteger} <: Real end
This would mean that things like FixedPoint{T, 2//3}
, FixedPoint{T, :sym}
or FixedPoint{T, -1}
would throw.
PS: my package is large, but, TBH, only a small fraction of it is required for implementing NonnegativeInteger
. I hate to say this, but it might make sense for FixedPointNumbers
to depend on a new, minimal, package, extracted from the source of TypeDomainNaturalNumbers
. Obviously I'd try to make the two packages as compatible as possible while keeping the small package as tiny as possible. Say if this sounds interesting.
PSPS: I think there may be low-hanging fruit for optimizing the compilation latency of my package. I'm looking for a representative workload which I could benchmark before plucking these. So, if you find the latency problematic, please open an issue.
FTR: upstream invalidations are currently also an issue regarding latency. I'll start making more PRs to JuliaLang/julia to try to address this.