bit syntax: what does "<<1234>> =" match?

Anton Lebedevich <>
Fri Feb 25 20:23:27 CET 2011


Hello,

In erlang R14B01 shell:
1> <<1234>> = <<1234>>.
** exception error: no match of right hand side value <<"Ò">>

Right side of expression evaluates to <<210>> (8 least significant bits
from 1234), so the following matches:
2> <<210>> = <<1234>>.
<<"Ò">>

1234 on the left side of expression should evaluate to <<210>> too, but
it doesn't:
3> <<1234>> = <<210>>.
** exception error: no match of right hand side value <<"Ò">>

Is there an explanation of what happens when integer on left side of
binary matching expression doesn't fit into default 8 bit?

Regards,
Anton Lebedevich.



More information about the erlang-questions mailing list