Closed briochemc closed 4 years ago
Sounds good, PR welcome. But note that for the example, no @with_kw
is needed as @unpack
works with any type. Also, I'm planning to split off pack/unpack into https://github.com/mauro3/UnPack.jl, so best to make the PR against that repo.
OK I'll do that!
Done!
Tnx! x-ref https://github.com/mauro3/UnPack.jl/pull/2
I think it would help to have an example of how to specialize the
unpack
function.So far I have been redefining the
getproperty
function (the effect of which is mentioned in the docs), but reading through the "customization" part of the docs seems to suggest one should instead add methods tounpack
. However, there is no example of that, and I failed at trying it. As a MWE, trying to multiply by2
while unpacking viawhere
T
is my custom type, did not work for me. (FWIW in my case I was trying to do some scaling, specifically converting to SI units to be precise.)So I would love to be taught how to do this properly, but I think an example in the docs would be great IMHO! 🙂
EDIT: OK I'm an idiot, I forgot to "import"
unpack
... This worked for me:Maybe the MWE example below could be added anyway?