# Disallow more subtypes

**URL:** https://discourse.julialang.org/t/disallow-more-subtypes/73103
**Category:** General Usage
**Created:** [December 14, 2021, 11:25pm UTC](https://discourse.julialang.org/t/disallow-more-subtypes/73103 "2021-12-14T23:25:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)
#### Post date: [December 14, 2021, 11:25pm UTC](https://discourse.julialang.org/t/disallow-more-subtypes/73103/1 "2021-12-14T23:25:31Z")

</div>

```julia
abstract type Foo end

struct FooA <: Foo 
x
end

struct FooB <: Foo
x
end

```

I want to disallow any other concrete types of `Foo`. Is that possible?

---

<div class="post-metadata">

### Author: ![gbaraldi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gbaraldi/32/22101_2.png) [@gbaraldi](https://discourse.julialang.org/u/gbaraldi)
#### Post date: [December 15, 2021, 12:07am UTC](https://discourse.julialang.org/t/disallow-more-subtypes/73103/2 "2021-12-15T00:07:19Z")

</div>

Not really. What is your use case for that?

---

<div class="post-metadata">

### Author: ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)
#### Post date: [December 15, 2021, 12:18am UTC](https://discourse.julialang.org/t/disallow-more-subtypes/73103/3 "2021-12-15T00:18:45Z")

</div>

if you are using Foo for dispatch, you could do:

```julia
struct FooA
  x
end

struct FooB
  x
end

const Foo = Union{FooA,FooB}

```

that will make `Foo` impossible to extend, but available for dispatch
