# Type of function arguments ignored

**URL:** <https://discourse.julialang.org/t/type-of-function-arguments-ignored/9422>\
**Category:** General Usage\
**Tags:** type\
**Created:** [March 1, 2018, 4:44pm UTC](https://discourse.julialang.org/t/type-of-function-arguments-ignored/9422 "2018-03-01T16:44:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mvhulten](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mvhulten/32/2444_2.png) [@mvhulten](https://discourse.julialang.org/u/mvhulten)\
**Post date:** [March 1, 2018, 4:44pm UTC](https://discourse.julialang.org/t/type-of-function-arguments-ignored/9422/1 "2018-03-01T16:44:34Z")

</div>

```julia
julia> function myplus(x::UInt,y::UInt)
           x+y
       end
myplus (generic function with 2 methods)

julia> myplus(3,-4)
-1

julia> myplus(im,-4π) == im+-4π
true

```

Since I “declared” `x` and `y` as natural numbers, should it not throw an exception if one fills in non-natural numbers?

Possibly, I don’t understand what `::` does in this context.

I’m using Julia 0.7.0-DEV.3686.

---

<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:** [March 1, 2018, 4:46pm UTC](https://discourse.julialang.org/t/type-of-function-arguments-ignored/9422/2 "2018-03-01T16:46:57Z")

</div>

Restart your julia and try again. Looks like you have another method definition this session.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [March 1, 2018, 4:49pm UTC](https://discourse.julialang.org/t/type-of-function-arguments-ignored/9422/3 "2018-03-01T16:49:13Z")

</div>

Note that Julia is telling you that the `myplus` function has two methods defined on it. You can see what those methods are with `methods(myplus)`. And you can see which method a set of arguments will use with `@which myplus(3, -4)`.

---

<div class="post-metadata">

**Author:** ![mvhulten](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mvhulten/32/2444_2.png) [@mvhulten](https://discourse.julialang.org/u/mvhulten)\
**Post date:** [March 1, 2018, 5:05pm UTC](https://discourse.julialang.org/t/type-of-function-arguments-ignored/9422/4 "2018-03-01T17:05:42Z")

</div>

Thanks, it was indeed solved by restarting Julia.

It must have been another method, indeed. I was not realising I am defining multiple methods to `myplus` when redefining it with different types. That could be quite useful!

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [March 1, 2018, 5:19pm UTC](https://discourse.julialang.org/t/type-of-function-arguments-ignored/9422/5 "2018-03-01T17:19:01Z")

</div>

Useful indeed. In fact, this is one of the fundamental ideas of Julia: [https://docs.julialang.org/en/stable/manual/methods/](https://docs.julialang.org/en/stable/manual/methods/)
