Skip to content

Conversation

@chrisrink10
Copy link
Member

@chrisrink10 chrisrink10 commented Feb 23, 2020

Add a JSON encoder and decoder based on Python's json module.

This is obviously not going to be the fastest encoder or decoder in the planet, but it will be builtin so folks don't have to fetch another library to do the job. It's made worse by the fact that Python's builtin decoder does not include an array_hook option. We could probably make a fairly efficient decoder with that and the existing object_hook, but since we have the completely decode the entire object to Python objects and then convert, it's probably pretty slow.

Fixes #484, #554

@chrisrink10 chrisrink10 added the wip PR is work-in-progress label Feb 23, 2020
(->> (group-by first methods)
(reduce (fn [m [method-name arities]]
(->> (map rest arities)
(apply list `fn method-name)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the extended method function uses the dispatch method name, then the compiler will add the local function name to the symbol table for that name and users will be unable to call the generic Protocol dispatch method.

@chrisrink10 chrisrink10 removed the wip PR is work-in-progress label Jun 5, 2020
@chrisrink10 chrisrink10 marked this pull request as ready for review June 5, 2020 13:27
@chrisrink10 chrisrink10 merged commit cf4346e into master Jun 6, 2020
@chrisrink10 chrisrink10 deleted the feature/json-encoder branch June 6, 2020 00:09
@chrisrink10 chrisrink10 linked an issue Jun 6, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Namespace docstrings are never added to the Namespace meta Add builtin basilisp.json JSON serializer/deserializer

2 participants