Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idea for a breaking release: type safety, by relying on TypeDomainNaturalNumbers.jl #308

Open
nsajko opened this issue Oct 3, 2024 · 0 comments

Comments

@nsajko
Copy link

nsajko commented Oct 3, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant