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

Domain as an interface #120

Closed
daanhb opened this issue Sep 13, 2022 · 3 comments
Closed

Domain as an interface #120

daanhb opened this issue Sep 13, 2022 · 3 comments

Comments

@daanhb
Copy link
Member

daanhb commented Sep 13, 2022

The discussion came up again whether or not to see domains as inheriting from Domain{T}, or whether it can be an interface instead: JuliaMath/IntervalSets.jl#117 and JuliaMath/IntervalSets.jl#115

Related to that is the question of what is the role of T in Domain{T}.

@daanhb
Copy link
Member Author

daanhb commented Sep 13, 2022

As a random example, this is current behaviour in DomainSets:

julia> using IntervalSets, DomainSets

julia> using DomainSets: ×

julia> d = (0..1.0) × ComplexUnitCircle()
(0.0 + 0.0im..1.0 + 0.0im) × ComplexUnitCircle()

julia> eltype(d)
SVector{2, ComplexF64} (alias for StaticArraysCore.SArray{Tuple{2}, Complex{Float64}, 1, 2})

julia> numtype(d)
ComplexF64 (alias for Complex{Float64})

julia> prectype(d)
Float64

A type promotion happens when taking the cartesian product. Next, the T in this example is a static vector and conveys information about the numeric type (the elements of the vector, here ComplexF64) and the precision type (Float64).

@dlfivefifty
Copy link
Member

One comment: we can still support eltype even if it is just an interface (that is, each domain would overload eltype)

@daanhb
Copy link
Member Author

daanhb commented Jan 20, 2023

Related issue on moving the definition of a Domain into a new and very lightweight package: JuliaMath/IntervalSets.jl#136

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

2 participants