[erlang-questions] String versus variable in binary literal

Joe Armstrong erlang@REDACTED
Wed May 16 12:29:35 CEST 2012


On Wed, May 16, 2012 at 10:56 AM, Richard Carlsson
<carlsson.richard@REDACTED> wrote:
> 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.

It's a bug (or should be a bug) - try this for size:

>  <<1223232321111,3476824682351,18368119>>.
<<"Wow">>

Isn't that beautiful :-)


/Joe







/Joe


>
>   /Richard
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list