[erlang-questions] [eeps] EEP 9

Vlad Balin gaperton@REDACTED
Sat Mar 8 16:34:40 CET 2008


One more issue. Take this function as an example.

split(Binary, SplitKeys) -> List
            Binary = binary()
            SplitKeys = binary() | [binary()]


Wouldn't it be useful to allow integers in SplitKeys in place of
binaries? We can treat them as 1-byte binaries (should be easy to
implement), and it will make code more readable in cases when keys
consist of 1 character.

With this option, we can just write

split( Buffer, "\n " )

instead of

> binary:match(<<"hello, world\n">>,[<<"\n">>,<<" ">>]).

It can be applied to many functions in this module, and it should
increase code readability in general.

Thanks,
Vlad.



More information about the erlang-questions mailing list