Closed alex-s-gardner closed 1 year ago
@evetion can we bring back that constructor?
Yeah, I will make a PR. Although it seems like a weird API, did anyone use it as such?
I cant remember intentionally doing that. Did it call convert or somrthing?
@alex-s-gardner Do you actually call EPSG(::EPSG)
, or test for type equality? I'm sorry if we broke your code. While technically breaking (the type signature), we thought we could get away with it, as I made sure the tests stayed green. Also:
julia> a = EPSG(4326)
julia> typeof(a) <: GeoFormatTypes.EPSG
true
julia> a isa GeoFormatTypes.EPSG
true
I cant remember intentionally doing that. Did it call convert or somrthing?
Yeah, it recognized EPSG requires an Int and EPSG can convert to that directly. Doesn't seem to work out of the box for NTuples though.
Oh right its still actually an EPSG
just not exactly the type. I misunderstood the comparison.
Thats not actually breaking, type parameter equality is not promised.
This is the reason to use <:
rather than ==
for types
OK, I used both of these in FastGeoProjections but if they are not considered breaking then we're all good.
How does one assert function input to be a subtype of?
source_epsg :: EPSG
I would have thought something like source_epsg:: <: EPSG of source_epsg:: <: EPSG
but neither work and searching has proven fruitless
Exactly like you want:
function do_thing(source_epsg::EPSG)
Although I do sometimes try to write <:
, but that's only for parametric types in methods.
You can derive this logically:
do_thing(something)
equals do_thing(something::Any)
and 1 isa Any == true
and typeof(1) <: Any == true
.
Documentation is here.
22 is breaking.
using GeoFormatTypes v0.4.1
using GeoFormatTypes v0.4.2