[erlang-questions] map elements in defined order

Richard A. O'Keefe ok@REDACTED
Mon Oct 30 01:16:42 CET 2017



On 28/10/17 2:34 AM, Sverker Eriksson wrote:
[term_to_binary/1 is not a pure function; it
depends on the representation of its argument,
not just its value].

OUCH.

For term_to_binary/2, of course the result
depends on the Options argument, but I take
it now that even being explicit about the
Options is not enough.  Can we have a
'canonical' option?

>
> And in the case where M1 and M2 were created by different VM instances,
> you can with current implementation get different binaries.

I can live with different *versions* of the VM using different
versions of the binary term format, but two instances of the *same*
VM turning mathematically identical terms into different binaries
is, well, did Nyarlathotep, the Crawling Chaos, have a hand in the
design?  In all seriousness, *OUCH*.  Please mention this in LARGE
red letters in the documentation for term_to_binary; I don't see it
at the moment, but it puts limits on what you can reasonably do
with terms-as-binaries.





More information about the erlang-questions mailing list