# Custom implicit type conversion

**URL:** https://discourse.julialang.org/t/custom-implicit-type-conversion/117315
**Category:** General Usage
**Tags:** type, convert
**Created:** [July 22, 2024, 1:42am UTC](https://discourse.julialang.org/t/custom-implicit-type-conversion/117315 "2024-07-22T01:42:01Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![GHTaarn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ghtaarn/32/216007_2.png) [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)
#### Post date: [July 23, 2024, 1:29am UTC](https://discourse.julialang.org/t/custom-implicit-type-conversion/117315/4 "2024-07-23T01:29:04Z")

</div>

Thank you @jling and @Benny , your answers and a reread of the manual suggest to me that Julia will not implicitly call `convert` in order to find a matching method. My example above was just an MWE to help me understand `convert`, what I really want to do is something like:

```julia
struct MyType <: Function end

(::MyType)(x) = println("Hello $x")
Base.convert(::Type{MyType}, x::Function) = MyType()

dosomething(x::MyType, y) = println(x(y), " says hello")

dosomething(8) do x
    x^2
end

```

which I now can see does not work because the new `convert` method is not implicitly called. The main goal here is to be able to use `do` syntax without changing (or adding methods to) `dosomething`. Is there something akin to `convert` that can be used to achieve this?

---

_[View the full topic](https://discourse.julialang.org/t/custom-implicit-type-conversion/117315)._
