JuliaApproximation / DomainSets.jl

A Julia package for describing domains as continuous sets of elements
MIT License
72 stars 12 forks source link

Domain as an interface #120

Closed daanhb closed 7 months ago

daanhb commented 2 years ago

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

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

daanhb commented 2 years ago

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 commented 2 years ago

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

daanhb commented 1 year ago

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