# Help decoding this deprecation

**URL:** https://discourse.julialang.org/t/help-decoding-this-deprecation/9130
**Category:** General Usage
**Created:** [February 17, 2018, 4:40pm UTC](https://discourse.julialang.org/t/help-decoding-this-deprecation/9130 "2018-02-17T16:40:00Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [February 17, 2018, 4:40pm UTC](https://discourse.julialang.org/t/help-decoding-this-deprecation/9130/1 "2018-02-17T16:40:00Z")

</div>

Sorry, IMO, another `complicate it` evolution example.  
How do I write the new correct form?

```julia
julia> contains(==, fieldnames(GMT.GMTgrid), Symbol("z"))
┌ Warning: `contains(eq::Function, itr, x)` is deprecated, use `any((y->begin
│ eq(y, x)
│ end), itr)` instead.
│ caller = top-level scope
└ @ Core :0
true

julia> any((y->begin == end), fieldnames(GMT.GMTgrid), Symbol("z"))
ERROR: MethodError: no method matching start(::Symbol)
Closest candidates are:
  start(::SimpleVector) at essentials.jl:550
  start(::Base.MethodList) at reflection.jl:659
  start(::ExponentialBackOff) at error.jl:171
  ...
Stacktrace:
 [1] reduced_indices(::Tuple{Base.OneTo{Int64}}, ::Symbol) at .\reducedim.jl:35
 [2] reduced_indices at .\reducedim.jl:6 [inlined]
 [3] reducedim_initarray at .\reducedim.jl:79 [inlined]
 [4] reducedim_initarray at .\reducedim.jl:80 [inlined]
 [5] reducedim_init at .\reducedim.jl:133 [inlined]
 [6] mapreducedim at .\reducedim.jl:272 [inlined]
 [7] any(::Function, ::Array{Symbol,1}, ::Symbol) at .\reducedim.jl:612
 [8] top-level scope

```

---

<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: [February 17, 2018, 5:17pm UTC](https://discourse.julialang.org/t/help-decoding-this-deprecation/9130/2 "2018-02-17T17:17:09Z")

</div>

```julia
julia> struct Foo
           a
           z
       end

julia> any(equalto(:z), fieldnames(Foo))
true

julia> any(equalto(:b), fieldnames(Foo))
false

```

---

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [February 17, 2018, 5:22pm UTC](https://discourse.julialang.org/t/help-decoding-this-deprecation/9130/3 "2018-02-17T17:22:34Z")

</div>

Thanks, though that is not what the deprecation message points as to.

> [@joa-quim](#):
>
> Warning: `contains(eq::Function, itr, x)` is deprecated, use `any((y->begin eq(y, x) end), itr)` instead.

---

<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: [February 17, 2018, 5:31pm UTC](https://discourse.julialang.org/t/help-decoding-this-deprecation/9130/4 "2018-02-17T17:31:23Z")

</div>

It is basically telling you to use:

```julia
julia> any(y -> y == :z, fieldnames(Foo))
true

```

---

<div class="post-metadata">

### Author: ![piever](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/piever/32/1815_2.png) [@piever](https://discourse.julialang.org/u/piever)
#### Post date: [February 17, 2018, 5:37pm UTC](https://discourse.julialang.org/t/help-decoding-this-deprecation/9130/5 "2018-02-17T17:37:58Z")

</div>

Slightly off-topic: an interesting possibility is this [PR](https://github.com/JuliaLang/julia/pull/24990) who would allow to create these currified functions with underscores, so this would become:

```julia
julia> any(_ == :z, fieldnames(Foo))
true

```

which IMO is more elegant than a specialized currified version `equalto`

From what I understood, this didn’t make it for Julia 0.7 but will be part of a future release.
