# How do I set bounds for a parametric subtype of a parametric abstract type?

**URL:** https://discourse.julialang.org/t/how-do-i-set-bounds-for-a-parametric-subtype-of-a-parametric-abstract-type/122101
**Category:** New to Julia
**Tags:** type, parametric-types
**Created:** [October 31, 2024, 11:46pm UTC](https://discourse.julialang.org/t/how-do-i-set-bounds-for-a-parametric-subtype-of-a-parametric-abstract-type/122101 "2024-10-31T23:46:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![martin\_sanchez](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martin_sanchez/32/207525_2.png) [@martin\_sanchez](https://discourse.julialang.org/u/martin_sanchez)
#### Post date: [October 31, 2024, 11:46pm UTC](https://discourse.julialang.org/t/how-do-i-set-bounds-for-a-parametric-subtype-of-a-parametric-abstract-type/122101/1 "2024-10-31T23:46:04Z")

</div>

In theory, the use of Dummy{T} without explicitly declaring a “scope” for T, would mean that Dummy is an abstract type. But if I try to make an abstract type with that structure:

```julia
julia> abstract type Dummy{T} end

```

It works, but when I try to subtype it:

```julia
julia> struct QueCono{T}<:Dummy{T} where T<:Real
       a::Float64
       b::T
       end

```

I get the error:

```julia
ERROR: invalid subtyping in definition of QueCono: can only subtype data types.
Stacktrace:
 [1] top-level scope
   @ REPL[12]:1

```

---

<div class="post-metadata">

### Author: ![kapple](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kapple/32/218915_2.png) [@kapple](https://discourse.julialang.org/u/kapple)
#### Post date: [November 1, 2024, 1:42am UTC](https://discourse.julialang.org/t/how-do-i-set-bounds-for-a-parametric-subtype-of-a-parametric-abstract-type/122101/2 "2024-11-01T01:42:32Z")

</div>

Yeah this part of Julia syntax is sometimes tricky for me in remembering how to specify the parametric type’s bounds.

I also see your choice of a name for your subtype suggests your level of frustration 😅 in fact [you’re not alone in this frustration](https://discourse.julialang.org/t/why-isnt-this-legal-syntax-for-defining-a-subtype/121479).

As in thread I linked, the working syntax is

```julia
abstract type Dummy{T} end

struct EstoTieneSentido{T <: Real} <: Dummy{T}
    a::Float64
    b::T
end

```

---

<div class="post-metadata">

### Author: ![martin\_sanchez](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martin_sanchez/32/207525_2.png) [@martin\_sanchez](https://discourse.julialang.org/u/martin_sanchez)
#### Post date: [November 1, 2024, 3:41am UTC](https://discourse.julialang.org/t/how-do-i-set-bounds-for-a-parametric-subtype-of-a-parametric-abstract-type/122101/3 "2024-11-01T03:41:59Z")

</div>

Sorry, I didn’t edit the code 😅 I really appreciate your comment.

---

<div class="post-metadata">

### Author: ![kapple](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kapple/32/218915_2.png) [@kapple](https://discourse.julialang.org/u/kapple)
#### Post date: [November 1, 2024, 3:49am UTC](https://discourse.julialang.org/t/how-do-i-set-bounds-for-a-parametric-subtype-of-a-parametric-abstract-type/122101/4 "2024-11-01T03:49:45Z")

</div>

Haha, that’s okay. I’ve had a lot of frustrations learning Julia as well, they’re just much, MUCH more preferable frustrations than I’ve had with other languages. I am also personally supportive of opportunities to vent, and have constructively done so here. Another location for smaller gripings is in [Slack](https://julialang.slack.com/archives/C67TK21LJ).

Thank you for taking the time to ask your question rather than letting it go unasked. Don’t be afraid to ask other questions after doing some research on it, which I find is the best way to learn and develop skills.

And between you and me, I’ve put cusses in code as well. 😛 Moreso my MATLAB code. And maybe once or twice in Julia trying to get plot recipes working in Plots.jl or Makie.jl.

Also, I took the liberty of making your question-title more specific ☺.
