I have a situation in which “splatting” a ComponentArray into keyword arguments would be useful. Unfortunately, it is not currently possible. I was wondering whether it would be possible in principle? Could I add that capability?
MWE
using ComponentArrays
x = ComponentArray(a = 1, b = 2)
f(;a, b) = a + b
f(;x...)
Although converting to a NamedTuple does work, it does add some overhead. Out of curiosity, would your more permanent solution with merge be more efficient?
Unfortunately merge is going to have to convert to NamedTuple to perform the merge with the empty NamedTuple anyway (which is how keyword argument splatting works). I don’t think there is any way to buy into the keyword arg splatting without doing this. Maybe I’m wrong, though. Might be worth checking.