binary_to_term and leaking atoms

Jayson Vantuyl kagato@REDACTED
Mon Jan 4 03:58:40 CET 2010


I've been writing a lot of Erlang lately, and I feel like I'm missing something.

Specifically, list_to_existing_atom is awesome for preventing atom leak; binary_to_term is great for easily building flexible network protocols; and {packet,N} makes framing the protocol a breeze.

That said, I can't get the safety of list_to_existing_atom with binary_to_term.  binary_to_term will automatically create any atoms (as well as funs) that a remote sender wants.  This is has necessitated writing custom protocol encoders / decoders, and makes Erlang's external binary term format incredibly useless.  It would be very nice to add a version of binary_to_term that has an extra argument which contains options.  This would generally useful to allow prohibiting creation of new atoms, prohibiting creation of funs / pids, and maybe even to specify backwards-compatible binary formats (making it easier to interoperate with older versions of Erlang).

-- 
Jayson Vantuyl
kagato@REDACTED







More information about the erlang-questions mailing list