I’m working on a basic gql client for zig but these questions really apply to any sort library design that uses std.json as an impl detail
-
I’m struggling with whether or not it makes sense to bubble up std.json.Parsed wrapper types in my pub interface. I’ve run into a number of runtime segfault issues with calling parsed.deinit and then passing value up to the caller. This feels like implementation detail leakage https://github.com/softprops/zig-graphql/blob/a34adc2dd88db89f0a884daaa85af956b271d1e5/src/main.zig#L114. Is there a better way to do this?
-
I’ve run into a number of related runtime segfault issues when the alloc option of json parser api is set to the default https://github.com/softprops/zig-graphql/blob/a34adc2dd88db89f0a884daaa85af956b271d1e5/src/main.zig#L172. I’ve only been able to get reliable results with alloc_always which makes me feel I’m trading off something potentially good for better runtime predictability. Is there a better way to do this?