rudolph-miller / jonathan

JSON encoder and decoder.
http://rudolph-miller.github.io/jonathan/overview.html
164 stars 24 forks source link

Allow serializing JSON directly to a stream. #34

Open tmccombs opened 8 years ago

rudolph-miller commented 8 years ago

How about with :octets t ?

tmccombs commented 8 years ago

Right, I forgot to mention that it only works with character streams, and octets t overrides it.

Actually, I just thought of a way to add support for octet streams without too much effort, I'll add that to this pull request.

rudolph-miller commented 8 years ago

I won't merge any PRs without tests. :( Please add test cases includes :stream stream and :stream stream :octets t.

And, it's better to me to rename keyword :stream to :output because stream can be input or output. :)

rudolph-miller commented 8 years ago

And, I saw PR in fast-io. After this PR is merged, I will remove (fast-io::flush *stream*) .

tmccombs commented 8 years ago

Hmmm, I need to update compile-encoder and the compiler macro as well.

tmccombs commented 8 years ago

I played around with it for a while, but eventually realized that the evals execute the code in a null lexical environment, which makes it difficult to capture the output stream. If you have any ideas on how to get compile-encoder to work with an output stream I would be happy to help implement it.