# Warnings about unused parameter in method

**URL:** https://discourse.julialang.org/t/warnings-about-unused-parameter-in-method/58956
**Category:** General Usage
**Tags:** warning
**Created:** [April 10, 2021, 12:10am UTC](https://discourse.julialang.org/t/warnings-about-unused-parameter-in-method/58956 "2021-04-10T00:10:55Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kumarbalachandran](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@kumarbalachandran](https://discourse.julialang.org/u/kumarbalachandran)
#### Post date: [April 10, 2021, 12:10am UTC](https://discourse.julialang.org/t/warnings-about-unused-parameter-in-method/58956/1 "2021-04-10T00:10:55Z")

</div>

So I have a declaration as below

```julia
abstract type C end
struct A <:C
       x::Float64
       y::Float64
end
function pattern(ant::A, pos::Float64)
return pos^2
end

struct B <: C
       x::Float64
       y::Float64
       z::Float64
end
function pattern(ant::B, pos::Float64)
return B.z*pos^2
end

```

and the warning generated is that ant is unused in the first pattern method-- this is logical because that is the case. However, the object is being passed into the function to differentiate it from application of the pattern function to another object, where the object is relevant – multiple dispatch at work. I don’t suppose there is any way of suppressing the compiler warning for this instance, is there? Its probably not a big deal.

/K

---

<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: [April 10, 2021, 1:01am UTC](https://discourse.julialang.org/t/warnings-about-unused-parameter-in-method/58956/2 "2021-04-10T01:01:48Z")

</div>

I’d probably write that as:

```julia
function pattern(::A, pos::Float64)
  pos^2
end

```

which hopefully makes it clear to the reader (and to whatever tool is generating the warning) that the first argument’s value is unused but its type is relevant.

---

<div class="post-metadata">

### Author: ![kumarbalachandran](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@kumarbalachandran](https://discourse.julialang.org/u/kumarbalachandran)
#### Post date: [April 12, 2021, 4:09am UTC](https://discourse.julialang.org/t/warnings-about-unused-parameter-in-method/58956/3 "2021-04-12T04:09:31Z")

</div>

That worked like magic./K
