For collection types, I normally expect a constructor to copy it rather than returning it.
julia> x = []
Any[]
julia> y = Vector(x)
Any[]
julia> x === y
false
And for non-collection types with one field, it's not obvious that the result should even return a copy of the argument, rather than putting the argument into the field, as in a default constructor.
# Batteries
julia> mutable struct Foo
x
end
julia> @batteries Foo
Foo
julia> x = Foo([])
Foo(Any[])
julia> y = Foo(x)
Foo(Any[])
# Normal
julia> struct Bar
x
end
julia> Bar(Bar([]))
Bar(Bar(Any[]))
Because this constructor behaves in unusual ways, I don't think it should be enabled by default. I'd lean toward just removing the option.
It is a good point, people might have different expectations of a selfconstructor. I agree, that selfconstructor=false may be the better default. But I am hesitant to do that breaking change.
https://github.com/jw3126/StructHelpers.jl/blob/560b49442c361fcb8dbe65b622844566cf242074/src/StructHelpers.jl#L66
Because this constructor behaves in unusual ways, I don't think it should be enabled by default. I'd lean toward just removing the option.