[erlang-questions] Decoding term_to_binary in javascript

Joe Armstrong erlang@REDACTED
Tue Nov 15 14:48:55 CET 2011


That looks nice.  It looks like all I have to do is "bertify" my erlang term
and sent it to the browser, where it can be debertified.

The looks easier than going backwards and forwards via JASON mainly because
there is no generic term_to_jason but there is a generic bert:encode and
decode.

This should make life a *lot* easier.

I shall perform some experiments ...

/Joe




On Tue, Nov 15, 2011 at 1:35 PM, Ulf Wiger <ulf@REDACTED> wrote:

>
> If you can settle for BERT, I think there are some JavaScript
> implementations out there:
>
> https://github.com/rtomayko/node-bertrpc/blob/master/src/bert.js
>
> BR,
> Ulf W
>
> On 15 Nov 2011, at 12:57, Joe Armstrong wrote:
>
> > I'd like to send a term_to_binary encoded term to a web client and
> decode it in javascript.
> >
> > If I could do this it would eliminate the impedance mismatch between
> server-side databases
> > and client code in a browser. I want to totally eliminate conversions to
> and from JSON. Just send
> > raw blobs containing term_to_binary encoded data and pluck what I want
> in the client.
> >
> > I would not necessarily want to decode the entire blob, I might just
> want to extract a specific item
> > So for example if In Erlang I created a blob by saying
> >
> >       Blob = term_to_binary({thing,"foo","bar",["baz"]})
> >
> > I'd like to send this to a browser and in Javascript say:
> >
> >      var z = mylib_hd(my_lib_element(4,Blob))
> >
> > Whereby z would be the javascript string "baz".
> >
> > Has anybody implemented anything like this?
> >
> > /Joe
> >
> >
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111115/0db967e3/attachment.htm>


More information about the erlang-questions mailing list