Concurrent JSONDecoder/JSONEncoder

I agree we should keep higher-level solutions in mind, however, I've barely mentioned the problem I'm trying to solve so I don't know how others could think they know the "right" solution to it. It did feel a bit unsolicited in that regard since this isn't a help forum, and like nick said I thought my question stood properly on its own. Anyway, my original post was confusing and brought attention to the wrong things, I edited it to be more clear, sorry for that!

Jon: those are great points, I can definitely understand not wanting this as part of the default JSON**coder behavior since it's difficult to make a one-size-fits-all solution and there are other performance tasks to focus on. The problem is that I can't implement my own that conforms to the current Decoder and Encoder protocols.

Is it possible to tweak the Decoder and Encoder protocols to support more use cases? Maybe this discussion is more about evaluating the current state of those protocols.

1 Like

That's a good point and I think it is a symptom of Swift's (and before that Objective-C) lack of first class concurrency support. This has created a "fear of concurrency", which makes sense because it is so difficult and error prone to make your code concurrent in Swift. And so, as you recommend, concurrency is only picked as a last resort solution.

Hopefully this is something that Swift will address sooner than later.