Hi @benrimmington ,
Thanks for the suggestion - and sorry for the late reply. I just had to digest how the task-locals work. ![]()
So this requires the author of MyStruct to remember to add the property wrapper locally. I do consider that to be a workaround similarly to the CodableKey property wrapper mentioned in the proposal.
A goal of the proposal is to be able to add the dictionary encoding/decoding behavior to the key type, so that you will not need to remember other decorations of the code at the use point (MyStruct).
Your solution gives an extra configuration point (the task local value), which I guess can be thought of as both good and bad. Ultimately I think that it would make the API harder to use since you need to remember both the local decoration using the property wrapper - and you need to set the task local value.
I did find your suggestion educational and inspirational. Are there any existing cases of using task local values for configuration like you suggest?
Please let me know if you think I missed anything in interpreting your suggestion. :-)