[erlang-questions] Segmented binaries (was Parsing with regexp...)

Bjorn Gustavsson bjorn@REDACTED
Thu Nov 9 07:56:14 CET 2006

Actually, the original bit syntax prototype had sub binaries and
segmented binaries.

Sub binaries are just a reference to a part of a larger binary.
They are typically when you match out a binary using the bit syntax.

A segmented binary is a binary that consists of several smaller binaries.
Segmented binaries were typically created when binaries were concatenated.

We implemented sub binaries in R7B, but not segmented binaries. The main
reason was that binary matching became very complicated.

We might implement something similar to segmented binaries in a future release.
Our plan is that a segmented binary will be consolidated into one contigous
binary if you attempt do binary matching on it, thus avoiding the complexity
of matching a dis-contigous binary.


Robert Virding <robert.virding@REDACTED> writes:
> When you talk about spliting the binary do you mean that this is done 
> internally and transparently to the user? Or does the user see the list 
> of segments? The origianl implementation of binaries had this capability 
> of referencing segments of a large binary. Very good for pulling the 
> binary apart. Although you could use it for splicing together if you 
> were careful.
> Robert

Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list