Create a struct with uninitialized fields

Like this?

julia> mutable struct Point
           x
           y
           Point() = new()
       end

julia> p = Point()
Point(#undef, #undef)

julia> p.x = 2
2

julia> p.y = 3
3

julia> p
Point(2, 3)

Or do you want to do it without having access to the inner constructor?

12 Likes