[erlang-questions] idea: service pack one

Juan Jose Comellas juanjo@REDACTED
Wed Nov 14 23:13:41 CET 2007


I have only been using Erlang for about 2 months now, but for the project
I'm working on we decided to use binaries as a replacement for strings,
mainly to avoid the bloat caused by Erlang's standard strings. I ended up
writing a module for string operations on binaries, which I'm including
attached in case someone is interested on it (the unit tests require EUnit
from SVN).

One thing that I was always doing when iterating over binaries is doing
matches like the following one:

<<Head:Offset/binary, Char, Tail/binary>>

and the annoying thing is that I could never use pattern matching at the
function level because the argument representing the offset could not be
used within the pattern. The functions look like this:

fun(Bin, Offset) ->
 [...]

I don't see a way out of this with Erlang's current argument evaluation
rules, but I thought I should mention it.

I'd definitely like to be able to match binaries against regular
expressions. Another thing I'd like to see is the inclusion of the
binary_to_atom/1 function to avoid having to go through a list to convert an
atom to a binary.


On 11/13/07, Fredrik Svahn <fredrik.svahn@REDACTED> wrote:
>
> On Nov 13, 2007 10:27 PM, Joe Armstrong <erlang@REDACTED> wrote:
> > 6 ++++ fix BIFs for regexp, searching binaries etc - so people stop
> winging
>
> I guess I am one of the people whinging. :-)
>
> I have recently started writing an EEP on various operations on
> binaries that I would like to see added in a support library (e.g.
> searching for patterns/multipatterns, splitting by pattern, regex,
> some of them might be suitable to implement as BIFs, but that is a
> later question). Is there someone else out there already working on
> this?
>
> If not, please let me know what opertaions you would like to be able
> to do on binaries. Are there any design patterns or operations on
> binaries that you keep writing over and over again? Any code involving
> binaries which could be written in a more elegant way with a support
> function? Any operations which you feel would be suitable to implement
> as BIFs?
>
> BR /Fredrik
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071114/49d31b1d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bstr.zip
Type: application/zip
Size: 9287 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071114/49d31b1d/attachment.zip>


More information about the erlang-questions mailing list