# Resolving method ambiguity with Union

**URL:** <https://discourse.julialang.org/t/resolving-method-ambiguity-with-union/121106>\
**Category:** General Usage\
**Tags:** question, ambiguities\
**Created:** [October 9, 2024, 1:21pm UTC](https://discourse.julialang.org/t/resolving-method-ambiguity-with-union/121106 "2024-10-09T13:21:42Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![littlelib](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/littlelib/32/209324_2.png) [@littlelib](https://discourse.julialang.org/u/littlelib)\
**Post date:** [October 10, 2024, 7:45am UTC](https://discourse.julialang.org/t/resolving-method-ambiguity-with-union/121106/8 "2024-10-10T07:45:54Z")

</div>

> [@Tamas\_Papp](#):
>
> Sure, because that calls a different method (`typed_hvcat`).

Thank you for the correction. I should’ve checked that before, that was dumb of me.

I’ve been experimenting and searching for solutions, and it seems there’s no way of resolving the ambiguity issue when using Unions.  
Did [find](https://discourse.julialang.org/t/union-types-good-or-bad/46255/18) a somewhat better solution, using `@eval` to generate methods for each types.

```julia
for T in (:(Tuple{Vararg{Int}}), :Int)
    @eval Base.hvcat(blocks_per_row::$T, foos::Foo...)=Foo()
end

```

I guess this is the next best thing you can try when Unions can’t do the job.

---

_[View the full topic](https://discourse.julialang.org/t/resolving-method-ambiguity-with-union/121106)._
