There’s some type-system functionality which I believe exists in Julia, that I’d like to try to access. I don’t know of a better way to explain it than jumping straight to a code example.

```
connection(x, y) = false
connection(x::Ptr{Ptr{S}}, y::Ptr{T}) where {T, S <: T} = true
connection(Ptr{Ptr{Int64}}(), Ptr{Int64}())
connection(Ptr{Ptr{Int64}}(), Ptr{Integer}())
a_predicate(x) = connection(x(), Ptr{Integer}())
if false
# mock use of desired function
method = only(methodswith(Ptr, connection)) # pick out the method that returns `true`
unification_args = Tuple{T, Ptr{Integer}} where T
# fill in T, so that `method` applies to `unification_args`
result = unify(method, unification_args)
unification_output = result.T
end
unification_output = (Ptr{Ptr{T}} where T <: Integer)
# another way to compute the same result as `a_predicate`
the_same_predicate(x) = x <: unification_output
for T in [Ptr{Ptr{Int}}, Ptr{Int}, Ptr{Ptr{Float64}}]
@assert a_predicate(T) == the_same_predicate(T)
end
```

I’m looking for something with the same functionality as what is implied by the code: a function `unify`

that takes 1. a method and 2. a partially-specified type of arguments to a method, and returns a fully-specified type of arguments such that the method would apply, OR failure.

Failure in this case would arise for example in a call like

`unify(method, Tuple{Vector{T}, Ptr{Integer}} where T)`

, since there’s no assignment to T that makes `method`

applicable.

And then really, I would like to not necessarily use `method`

directly, but use `method.sig`

(minus the first element, which is just the function type itself), e.g.:

```
match(
Tuple{Ptr{Ptr{S}},Ptr{T}} where S<:T where T, # ...against this
Tuple{U, Ptr{Integer}} where U # match this....
).result == (:U = Ptr{Ptr{A}} where A <:Integer)
# or
match(
Tuple{Ptr{Ptr{S}},Ptr{T}} where S<:T where T, # ...against this
Tuple{Ptr{U{Int}}, Ptr{Integer}} where U # match this....
).result == (:U = Ptr) # not sure if this is right
```

This is an area with terminology I’m not very comfortable with, but I’m trying to use terms that appear to be consistent with e.g. https://stackoverflow.com/questions/4442314/differences-between-pattern-matching-and-unification and https://en.wikipedia.org/wiki/Unification_(computer_science)