# What is the difference bewtween these two types? ::Vector{GMTdataset{\_A, 2} where \_A\<:Real} and ::Vector{\<:GMTdataset{T, 2}}; ...) where T\<:Real

**URL:** https://discourse.julialang.org/t/what-is-the-difference-bewtween-these-two-types-vector-gmtdataset-a-2-where-a-real-and-vector-gmtdataset-t-2-where-t-real/130384
**Category:** General Usage
**Created:** [July 1, 2025, 5:14pm UTC](https://discourse.julialang.org/t/what-is-the-difference-bewtween-these-two-types-vector-gmtdataset-a-2-where-a-real-and-vector-gmtdataset-t-2-where-t-real/130384 "2025-07-01T17:14:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [July 1, 2025, 5:14pm UTC](https://discourse.julialang.org/t/what-is-the-difference-bewtween-these-two-types-vector-gmtdataset-a-2-where-a-real-and-vector-gmtdataset-t-2-where-t-real/130384/1 "2025-07-01T17:14:24Z")

</div>

Hi,

I’m puzzled with this method failure. There must be one difference because it errors with, but I really can’t figure what.

```julia
typeof(D)
Vector{GMTdataset{_A, 2} where _A<:Real} (alias for Array{GMTdataset{_A, 2} where _A<:Real, 1})

julia> GMT.line2multiseg(D)
ERROR: MethodError: no method matching line2multiseg(::Vector{GMTdataset{_A, 2} where _A<:Real})

Closest candidates are:
  line2multiseg(::Vector{<:GMTdataset{T, 2}}; is3D, color, auto_color, lt, color_col) where T<:Real
   @ GMT c:\Users\j\.julia\dev\GMT\src\utils_types.jl:1236

```

---

<div class="post-metadata">

### Author: ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)
#### Post date: [July 1, 2025, 6:32pm UTC](https://discourse.julialang.org/t/what-is-the-difference-bewtween-these-two-types-vector-gmtdataset-a-2-where-a-real-and-vector-gmtdataset-t-2-where-t-real/130384/2 "2025-07-01T18:32:56Z")

</div>

The `T<:Real` in that `where` clause demands a value (from the parameter `S` as I renamed below in an analogous `Ref` example) that `_{_A} where _A<:Real` just doesn’t provide. The two types are actually disjoint subtypes of a known wider type.

```julia
julia> (Vector{<:Ref{T}} where T<:Real) == (Vector{S} where {T<:Real, S<:Ref{T}}) # I dislike the <: shorthand
true

julia> Vector{Ref{_A} where _A<:Real} <: (Vector{S} where {T<:Real, S<:Ref{T}}) # why dispatch fails
false

julia> typeintersect(Vector{Ref{_A} where _A<:Real}, (Vector{S} where {T<:Real, S<:Ref{T}}))
Union{}

julia> Vector{Ref{_A} where _A<:Real} <: (Vector{S} where S<:(Ref{T} where T<:Real))
true

julia> (Vector{S} where {T<:Real, S<:Ref{T}}) <: (Vector{S} where S<:(Ref{T} where T<:Real))
true

```

---

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [July 1, 2025, 7:00pm UTC](https://discourse.julialang.org/t/what-is-the-difference-bewtween-these-two-types-vector-gmtdataset-a-2-where-a-real-and-vector-gmtdataset-t-2-where-t-real/130384/3 "2025-07-01T19:00:08Z")

</div>

Thanks for looking into this contrived case. Meanwhile I investigated more and found, less abstractly, why it failed.

The [GMTdatset](https://www.generic-mapping-tools.org/GMTjl_doc/documentation/general/types/index.html#dataset_type) type is defined as `GMTdataset{T<:Real, N}`

and I had a test that loosely created a vector of them mixing `Ints` and `Floats`

```julia
julia> D = [mat2ds([-1 -1; 1 1; 1 -1; -1 -1]), mat2ds([1.5 1.0; 1.5 1.5; 2.0 1.0; 1.5 1.0])];

julia> typeof(D)
Vector{GMTdataset{T, 2} where T<:Real} (alias for Array{GMTdataset{T, 2} where T<:Real, 1})

julia> D = [mat2ds([-1.0 -1; 1 1; 1 -1; -1 -1]), mat2ds([1.5 1.0; 1.5 1.5; 2.0 1.0; 1.5 1.0])];

julia> typeof(D)
Vector{GMTdataset{Float64, 2}} (alias for Array{GMTdataset{Float64, 2}, 1})

```

when I recently parameterized one function that accepts `Vector{GMTdataset{T,2}...` I started to get that error. Fixing the type mix solved the issue but the Julia error message was not clear at all to me (as you could testify).
