[erlang-questions] Binary Matching Restrictions
Thu May 6 08:13:23 CEST 2010
On Wed, May 5, 2010 at 11:03 PM, alisdair sullivan
> I misspoke, I meant specifically in the case of a recursive function. My question is why the optimization is not applied in the following case (some clauses omited):
> f(<<S:1/binary, Rest/binary>>) ->
> g(Rest, ...).
> g(Rest, ...) ->
> The documentation of the beam_bsm.erl module indicates the optimization should be applied in this case but bin_opt_info shows it is not.
beam_bsm mostly only analyzes code within a single
function, thought the comments do not explicitly say
To get your code optimized, you will need to move
the code for the g function into the f/1 function.
Alternately, the following should also also work:
f(<<S:1/binary, Rest/binary>>) ->
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-questions