erl_syntax and bitstrings ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

erl_syntax and bitstrings ?

Yoshi
Hi, I encountered following case where erl_syntax:abstract/1 returns exception when given a bitstring:

4> erl_syntax:abstract(<<0:1>>).
** exception error: bad argument: <<0:1>>
     in function  erl_syntax:abstract/1 (erl_syntax.erl, line 5951)

Is this expected ? The document says:
Term must be a literal term, i.e., one that can be represented as a source code literal.

I guess <<0:1>> can be put in a source code.


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: erl_syntax and bitstrings ?

Richard Carlsson-3
This is a bug. The code was not updated when bitstrings were added, and crashes when it tries to run binary_to_list(Bin) on the given binary. Thanks for reporting it!


        /Richard

2017-02-24 7:03 GMT+01:00 Yoshihiro Tanaka <[hidden email]>:
Hi, I encountered following case where erl_syntax:abstract/1 returns exception when given a bitstring:

4> erl_syntax:abstract(<<0:1>>).
** exception error: bad argument: <<0:1>>
     in function  erl_syntax:abstract/1 (erl_syntax.erl, line 5951)

Is this expected ? The document says:
Term must be a literal term, i.e., one that can be represented as a source code literal.

I guess <<0:1>> can be put in a source code.


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions