[erlang-questions] Binary Matching Restrictions

alisdair sullivan <>
Wed May 5 23:03:59 CEST 2010


>> Curious as to why functions had to end with a tail call to a function that performs a binary 
>> match instruction in order for optimizations to be applied,

> On what do you base that claim?

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, ...) ->
    ...
    f(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.




More information about the erlang-questions mailing list