[erlang-questions] unexpected result of term_to_binary

Joe Armstrong erlang@REDACTED
Mon Jan 21 21:44:07 CET 2013


On Mon, Jan 21, 2013 at 9:00 PM, Steve Davis <steven.charles.davis@REDACTED
> wrote:

> Hi Dmitry,
>
> It "makes sense" only if the "binary_to_term" decode is done in erlang.
>
>
No - your could do it in C or java or C++. remember it's an external formal.

It makes sense for an external program to examine the format - that way
we can "teach" C++ etc. to understand erlang terms.

Inside Erlang you only use pairs of functions term_to_binary and the inverse
binary_to_term

/Joe


> br,
> /s
>
> On Jan 21, 2013, at 1:53 PM, Dmitry Kolesnikov <dmkolesnikov@REDACTED>
> wrote:
>
> > Hello,
> >
> > This make sense to me!
> >
> > term_to_binary/1 returns a binary data object which is the result of
> encoding Term according to the Erlang external term format. See
> http://erlang.org/doc/apps/erts/erl_ext_dist.html
> >
> > Use list_to_binary or unicode:character_to_binary depends on your
> use-case.
> >
> > - Dmitry
> >
> > On Jan 21, 2013, at 9:38 PM, Steve Davis <steven.charles.davis@REDACTED>
> wrote:
> >
> >> The following appears to encode lists of integers as strings (?!?):
> >>
> >> Eshell V5.9.3  (abort with ^G)
> >> 1> term_to_binary([1,2,3,4]).
> >> <<131,107,0,4,1,2,3,4>>
> >>
> >> Is there a reason for this that I'm missing?
> >>
> >> regs,
> >> /s
> >>
> >> _______________________________________________
> >> erlang-questions mailing list
> >> erlang-questions@REDACTED
> >> http://erlang.org/mailman/listinfo/erlang-questions
> >
>
> _______________________________________________
> 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/20130121/71083731/attachment.htm>


More information about the erlang-questions mailing list