# Dispatching on module to prove ownership in package extensions

**URL:** <https://discourse.julialang.org/t/dispatching-on-module-to-prove-ownership-in-package-extensions/103037>\
**Category:** General Usage\
**Tags:** question, package-extensions\
**Created:** [August 21, 2023, 3:54pm UTC](https://discourse.julialang.org/t/dispatching-on-module-to-prove-ownership-in-package-extensions/103037 "2023-08-21T15:54:14Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 22, 2023, 6:42am UTC](https://discourse.julialang.org/t/dispatching-on-module-to-prove-ownership-in-package-extensions/103037/2 "2023-08-22T06:42:21Z")

</div>

> [@goerz](#):
>
> Unfortunately, I don’t think there’s any way to _directly_ dispatch on a module, since `typeof(SomeModule)` is `Module`

In Julia 1.10+ you can have a module as a type parameter and do something like (using the same example as in the talk):

```julia
julia> module HYPRE end;

julia> module Pardiso end;

julia> struct Algorithm{T} end

julia> f(::Algorithm{HYPRE}) = "HYPRE"
f (generic function with 1 method)

julia> f(::Algorithm{Pardiso}) = "Pardiso"
f (generic function with 2 methods)

julia> f(Algorithm{HYPRE}())
"HYPRE"

julia> f(Algorithm{Pardiso}())
"Pardiso"

```

That might be one way to use dispatch for it.

---

_[View the full topic](https://discourse.julialang.org/t/dispatching-on-module-to-prove-ownership-in-package-extensions/103037)._
