[erlang-questions] bit syntax: what does "<<1234>> =" match?
Mon Feb 28 10:22:32 CET 2011
Le 28 févr. 2011 à 01:40, Robert Virding a écrit :
> ----- "Anthony Ramine" <nox@REDACTED> wrote:
>> Le 26 févr. 2011 à 20:28, Robert Virding a écrit :
>>> One of the cool things with binaries is that there is no info in the
>> binary saying how it was created so I can do lots of fun things when I
>> pull it apart.
>> While it may be cool, I think the compiler should issue a warning when
>> an impossible pattern is encountered. 1234 is obviously not
>> representable with only 8 bits.
> The coolness was not an impossible pattern, I agree that the compiler should warn, but more the fact that you can pull apart a binary differently from how it was constructed. It is with that you can do cool things.
That certainly looks impossible to me, how can you match <<1234>>? You make it sound like if you know the underlying binary representation you can match it.
More information about the erlang-questions