[erlang-patches] Patch to add atom_to_binary, binary_to_atom, and binary_to_existing_atom

Bjorn Gustavsson bgustavsson@REDACTED
Wed Nov 19 11:40:24 CET 2008


2008/11/18 Matthew Dempsky <matthew@REDACTED>:
> The attached patch adds BIFs for atom_to_binary/1, binary_to_atom/1,
> and binary_to_existing_atom/1.  They behave pretty much exactly how
> their name implies.

Thanks!

Your code looks good, except for a little detail: binary_to_atom/1
should generate a system_limit exception
in the same way as list_to_atom/1 does if the binary is longer than
255 characters.

Since we plan to support Unicode in R13, we also plan to support
Unicode characters in atoms.
Therefore, we plan to implement binary_to_atom/1 so that it only
accepts binaries containing valid UTF-8
sequences. (We'll also extend list_to_atom/1 so that the list is
allowed to contain Unicode characters.)

/Bjorn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-patches mailing list