Dear all

In the simplified example below, I have the following syntax where I build an instance of a given function “foo”. I named this instance “mod” (but this name can vary) and, in this instance, I fill the sub-object “res” (empty at start) by a function fit!:

```
Base.@kwdef mutable struct Foo{
FUN <: Function,
RES
}
fun::FUN
res::Union{Nothing, RES}
end
function fit!(mod::Foo, x, y)
mod.res = mod.fun(x, y)
end
foo() = Foo{Function, Number}(+, nothing)
## Build an instance "mod"
mod = foo() ;
fit!(mod, 2, 3) ;
mod.res
julia > 5
```

What is above works. But I was asking if, instead this syntax, it was simple or not (and keeping efficiency) to get a syntax such as below and doing the same:

```
Base.@kwdef mutable struct Foo{
FUN <: Function,
FIT <: Function,
RES
}
fun::FUN
fit::FUN
res::Union{Nothing, RES}
end
## ?: fit = ...
## ?: foo() = Foo{Function, Function, Number}(+, fit, nothing)
## Build an instance "mod"
## and expected syntax
mod = foo()
mod.fit(2, 3) ; # here this should fill "mod.res" with 2 + 3
mod.res
julia > 5
```

I tried but was not successful.

If you have examples on how to manage this, I am interested.

Thanks