[erlang-questions] [eeps] EEP 9

Per Gustafsson per.gustafsson@REDACTED
Fri Mar 7 09:43:47 CET 2008

Very good work, but I do have some comments:

Just as for lists and strings I think that there should be two different 
modules one which just operates on binaries and one that operates on 
binaries which are really strings. This module seems to be first of 
these two for the most part so functions that only makes sense if the 
binaries are strings should probably reside in some other module. The 
string_as_binary module could have more or less exactly the same API as 
string and similar modules could be defined for utf8, utf16 and utf32 if 

*  to_upper(Binary1) -> Binary2
    to_lower(Binary1) -> Binary2

Should be in the string_as_binary module

* binary_to_atom(Binary) -> Atom
   atom_to_binary(Atom) -> Binary

As you write these should probably be in the erlang module along with

binary_to_existing_atom(Binary) -> Atom

* unsigned_to_bin(Integer)-> Binary

What does this function do? Does it create the shortest possible binary 
in which the unsigned integer would fit?

better names might be

   binary:from_unsigned(Integer) -> Binary
   binary:to_unsigned(Binary) -> Integer

* nth(N, Bin) -> Value

To also satisfy 0-indexers there should probably be a

   nth0(N, Bin) -> Value

just as in the lists module


More information about the erlang-questions mailing list