[erlang-questions] String versus variable in binary literal

Richard Carlsson carlsson.richard@REDACTED
Wed May 16 10:56:33 CEST 2012


On 05/16/2012 10:49 AM, Michel Rijnders wrote:
> Hi,
>
> Confused newbie here. Can someone please explain the following:
>
> 1>  <<"foo">>.
> <<"foo">>
> 2>  Foo = "foo".
> "foo"
> 3>  <<Foo>>.
> ** exception error: bad argument
>
> What's the error in the last case?
>
> Best,
> Michel

The bit syntax doesn't (currently) support encoding strings that are not 
constant literals. This is something that should be fixed, IMO.

    /Richard



More information about the erlang-questions mailing list