With a macro:
julia> using StaticModules
julia> obj = (;x=1, y=2);
julia> @with obj begin
@show x + y
end;
x + y = 3
With a macro:
julia> using StaticModules
julia> obj = (;x=1, y=2);
julia> @with obj begin
@show x + y
end;
x + y = 3