JuliaMath / Infinities.jl

A Julia package for representing infinity in all its forms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should `convert(::Type{<:InfiniteCardinal}, x) = convert(Integer, x)`?

LilithHafner opened this issue · comments

I think that adding convert(::Type{<:InfiniteCardinal}, x) = convert(Integer, x) would allow Base.OneTo(ℵ₀) to replace OneToInf(), and also allow us to delete all zero/one/oneunit specializations, and possibly more.

This is dubious because convert(T, x) has a docstring that says Convert x to a value of type T, but InfiniteCardinal is an Integer, so this is close.

Originally posted by @LilithHafner in #42 (comment)

as posted before:

No that isn't valid as convert(T, x) must return an element of type T

Use Base.oneto and InfiniteArrays.jl which support ∞