@unpack everthing?
https://github.com/mauro3/UnPack.jl/blob/91296e0f1820e7d5c9b040ee488658d1fe86697e/src/UnPack.jl#L92-L93
I was wondering whether it would make sense to extend this macro such that @unpack A unpacks all fieldnames in A? At the moment line 93 triggers that as an error
struct ABC
a
b
c
end
then
julia> A = ABC(1,2,3)
ABC(1, 2, 3)
julia> @unpack A
ERROR: LoadError: type Symbol has no field head
Stacktrace:
[1] getproperty(x::Symbol, f::Symbol)
@ Base ./Base.jl:42
[2] var"@unpack"(__source__::LineNumberNode, __module__::Module, args::Any)
@ UnPack ~/.julia/packages/UnPack/EkESO/src/UnPack.jl:93
I don't know whether such a method would have undesired consequences, but I'm thinking about an application where one deals with structs that contain many lengthy names (because naming is hard and to avoid naming conflicts when unpacking), such that changing everytime all the @unpack lenghty_name_1, lengthy_name_2, lengthy_name3 = A in all the functions where A is used is annoying and typo-prone.
@white-alistair
Sorry, only now saw https://mauro3.github.io/Parameters.jl/stable/manual/#The-type-specific-(un)pack-all-macros-(somewhat-dangerous)
Note that @unpack cannot know the type fields and thus could not unpack them.