I've never used it for anything, but it might be a way to get what you want.
--
David
JSON = JavaScript Object Notation. JSON is only native to JavaScript -
every other language needs encoder/decoder with some amount of hackage
to account for inevitable impedance mismatch between what the language
can represent and what JSON can represent.
If anything, for languages like C/C++/Java/C#, Gob has a smaller
impedance mismatch than JSON. On the other hand, JSON probably better
fits languages like Python or Ruby. Which one is better depends on the
specifics of your problem.
Any serialization format in C or C++ will be awkward and hackish
because they lack the right reflection support but as far as choosing
a format for C/C++, Gob would probably work better than json (easier
to implement, faster), assuming you don't need human readability.
-- kjk
On Sun, Jan 29, 2012 at 10:29 PM, Paul Borman <bor...@google.com> wrote:
Whaa?
> JSON = JavaScript Object Notation. JSON is only native to JavaScript -
"Nativity" is kind of a meaningless concept, as I can literally type JSON --
{
"guess_what": "valid JSON!",
"d": {
"really": true,
"difficulty": -1
}
}
-- which means implementing a JSON serialization mechanism for my
problem-domain in pretty much any language is as simple/trivial as it
gets. Try doing the same with .gob.
JSON is quickly becoming, or already is, the standard for all
non-performance-critical serialization jobs. That's awesome and a good
thing; don't fight it. :)
An important question...
Why you don't like JSON?
I don't mean that JSON is a silver bullet, just need to understand why
JSON don't fit your problem? Or why gob is the right (and only)
solution to your problem.
Without that, is a little hard to provide some help.
The rpc package don't impose a format, you can write one that use
messagepack, protobuff, avro, asn1 etc..
--
André Moraes
http://andredevchannel.blogspot.com/
--
André Moraes
http://andredevchannel.blogspot.com/
make the communication between go and python more easily.
Programs that care about performance can use BSON or MessagePack that
are binary and have implementations in many languages. BSON is
implemented in Python and Go as part of MongoDB bindings, and
MessagePack boasts many implementations as well.
Rémy.
> though, the netchan will use the gob too, so maybe i can implement the
> netchan protocol with python.
>
> make the communication between go and python more easily.
This would take some effort, parsing gob code would probably be the easy part :)
In any case,
On the go side you can wrap your rpc-calls (using PB, MP, Bson,
etc...) with channels and hide that from the users of your library.
On the python side you don't have channels, so you still need to
implement a library on top of something since it don't have channels,
probably using twisted library.