# Parametric type without type parameters

**URL:** <https://discourse.julialang.org/t/parametric-type-without-type-parameters/126218>\
**Category:** General Usage\
**Created:** [February 23, 2025, 7:00pm UTC](https://discourse.julialang.org/t/parametric-type-without-type-parameters/126218 "2025-02-23T19:00:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![azoviktor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/azoviktor/32/206405_2.png) [@azoviktor](https://discourse.julialang.org/u/azoviktor)\
**Post date:** [February 23, 2025, 7:00pm UTC](https://discourse.julialang.org/t/parametric-type-without-type-parameters/126218/1 "2025-02-23T19:00:47Z")

</div>

I want to create a parametric type that would depend on a lot of parameters (e.g. 3 integer types)

```julia
struct MyType{T<:Integer, S<:Integer, U<:Integer}
  t::T
  s::S
  u::U
end

```

For the multiple dispatch I plan to use only `T`. What I don’t like is that all the parameter types are printed when I work with objects of type `MyType`. Also, implementing a custom `Base.show` for `MyType` is not enough, since if I use `MyType` as a type parameter in another type (e.g. `Vector`), all the 3 type parameters `T, S, U` will be showed again.

Is there a workaround for this? Since I use parameter `T` only for multiple dispatch, I was thinking about implementing `MyType` as follows:

```julia
struct MyType{T<:Integer}
  t::T
  s::S where S<:Integer
  u::U where U<:Integer
end

```

Is this implementation equivalent to the first one?

---

<div class="post-metadata">

**Author:** ![yolhan\_mannes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yolhan_mannes/32/220485_2.png) [@yolhan\_mannes](https://discourse.julialang.org/u/yolhan_mannes)\
**Post date:** [February 23, 2025, 7:06pm UTC](https://discourse.julialang.org/t/parametric-type-without-type-parameters/126218/2 "2025-02-23T19:06:52Z")

</div>

I think I remember [GitHub - jonniedie/ConcreteStructs.jl: 🏩🏠🌆🏨🌇🏦](https://github.com/jonniedie/ConcreteStructs.jl) having something to hide parameters in types but I’m not sure

---

<div class="post-metadata">

**Author:** ![barucden](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barucden/32/26154_2.png) [@barucden](https://discourse.julialang.org/u/barucden)\
**Post date:** [February 23, 2025, 9:21pm UTC](https://discourse.julialang.org/t/parametric-type-without-type-parameters/126218/3 "2025-02-23T21:21:24Z")

</div>

Maybe a type alias would be sufficient?

```julia-repl
julia> struct X{S, T}
           a::S
           b::T
       end

julia> X(1, 0x01)
X{Int64, UInt8}(1, 0x01)

julia> [X(1, 0x01)]
1-element Vector{X{Int64, UInt8}}:
 X{Int64, UInt8}(1, 0x01)

julia> const Y{T} = X{Int64, T} where {T}
Y (alias for X{Int64})

julia> X(1, 0x01)
Y{UInt8}(1, 0x01)

julia> [X(1, 0x01)]
1-element Vector{Y{UInt8}}:
 Y{UInt8}(1, 0x01)

```

---

<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:** [February 24, 2025, 1:57am UTC](https://discourse.julialang.org/t/parametric-type-without-type-parameters/126218/4 "2025-02-24T01:57:29Z")

</div>

> [@azoviktor](#):
>
> Is this implementation equivalent to the first one?

Fields annotated with abstract types do not behave the same as fields annotated with concrete types, whether or not it happens via parameters. In this case, `MyType2{Int}` would be structured like `MyType1{Int, Integer, Integer}`.
