struct B
a
b
c
end
@unpack a, c = B(4,5,6)
# is equivalent to
BB = B(4,5,6)
a = BB.a
c = BB.c
julia> using Parameters
julia> @with_kw struct A
a::Int = 6
b::Float64 = -1.1
c::UInt8
end
julia> A(c=4)
A
a: 6
b: -1.1
c: 4
julia> A()
ERROR: Field 'c' has no default, supply it with keyword.
julia> A(c=4, a = 2)
A
a: 2
b: -1.1
c: 4
https://github.com/mauro3/Parameters.jl
Some interesting examples: