[erlang-questions] Strange difference between construction and matching of binaries

Peti Gömöri gomoripeti@REDACTED
Mon Dec 28 02:23:16 CET 2015


I'd just like to mention this related bug-report
http://bugs.erlang.org/browse/ERL-44 reported by yet another surprised
person.

On Wed, Dec 23, 2015 at 7:16 PM, Ameretat Reith <ameretat.reith@REDACTED>
wrote:

> `
> 1) AB = <<"AB">>.
> 2) << AB:1/bytes, $B >> = AB. %% does not match
> 3) AB = << AB:1/bytes, $B >>. %% will match
> `
>
> It's another example which I faced some days ago.  I think size
> specifier in matching segment just apply to unbound variables, in
> another word when construction will happen.
>
> I think It's just an implementation issue and a try to avoid making
> intermediate variables [1] and matching will checked bit-by-bit with
> referenced variables and finished as soon as It finds bits are not
> aligned anymore. I very like hear more about this too :)
>
> 1:
>
> http://www.erlang.org/doc/efficiency_guide/binaryhandling.html#match_context
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20151228/431a5490/attachment.htm>


More information about the erlang-questions mailing list