I was thinking about enums and I'm not sure that Pike enums are "featureful" enough for use in this: I think there is an assumption that you be able to get the value of an enum type from a string representation of its value. For example:
enum foo { bar, gazonk }
foo x = gazonk;
So given the string "gazonk" in the context of foo, return the value that's contained in x in the example above. I guess there also needs to be a convention for decoding a set of json data for an object type (i.e, each type includes a function that is /sort/ of the opposite of encode_json()). I also imagine that there would need to be a type - selector registry object that keeps track of all of the types it knows how to decode and the means for determining what type a json blob represents:
program type_for_json(mapping some_decoded_json);
Bill
January 2, 2019 12:04 PM, "Mateusz Krawczuk" <krawczukmat@gmail.com (mailto:%22Mateusz%20Krawczuk%22%20krawczukmat@gmail.com)> wrote: Inspired by the debugger discussion, I've started implementing QuickType support for the Pike language. You can check it out by cloning my github fork[1], checking out to 'Pike' branch, and following the 'Contribute' section in README.md. After successful installation, you can run $ ./script/quicktype --lang pike test/inputs/json/samples/pokedex.json to see if it's working fine.
The main motivation for this is generate Pike classes for the JSON-RPC messages specified in Microsoft's Debugger Adapter Protocol and Language Server Protocol. I imagine this could also turn out handy for people working with JSON-based APIs.
There is plenty of work to be done here, like supporting enums and handling reserved statements, so I encourage you to contribute! Any feeback is more than appreciated. Mateusz [1] https://github.com/mkrawczuk/quicktype/tree/Pike (https://github.com/mkrawczuk/quicktype/tree/Pike)