# Confused with type definition

**URL:** https://discourse.julialang.org/t/confused-with-type-definition/53115
**Category:** New to Julia
**Created:** [January 10, 2021, 2:18pm UTC](https://discourse.julialang.org/t/confused-with-type-definition/53115 "2021-01-10T14:18:27Z")
**Posts on this page:** 1
**Showing post:** 13

<div class="post-metadata">

### Author: ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)
#### Post date: [January 10, 2021, 4:05pm UTC](https://discourse.julialang.org/t/confused-with-type-definition/53115/13 "2021-01-10T16:05:25Z")

</div>

I am kinda surprised nobody mentioned [Lazy.jl](https://github.com/MikeInnes/Lazy.jl) and its macro [`@forward`](https://github.com/MikeInnes/Lazy.jl/blob/master/src/macros.jl#L276).

Basically you can do:

```julia
import Base: length, getindex, setindex
using Lazy: @forward

struct MyVec <: AbstractVector{Float64}
  v::Vector{Float64} # same as Array{Float64, 1}
end

@forward MyVec.v Base.size, Base.getindex, Base.setindex!

```

For all function you just delegate to the field.

---

_[View the full topic](https://discourse.julialang.org/t/confused-with-type-definition/53115)._
