[erlang-questions] Core erlang definition

Björn Gustavsson bjorn@REDACTED
Sat Mar 18 07:03:27 CET 2017


On Fri, Mar 17, 2017 at 8:31 PM, Robert Virding <rvirding@REDACTED> wrote:
> So this means that when you are representing data structures/patterns they
> should be "as literal as possible"? And only use explicit structures, for
> example #c_cons{}/#c_tuple{}, when they have elements which aren't literal
> values?

Yes, that's how v3_core represents literals when translating to Core Erlang.

That said, I just come to think about some changes we have made in
sys_core_fold in the master branch (to be OTP 20). Starting from
OTP 20, sys_core_fold will do a fix point iteration on each function,
that is, perform all transformations again and again until there is
no further change (or until the limit for the max number of iterations
is reached).

That probably means that it does not matter as much how literals
are represented. If the literals are not "as literal as possible", the
first round through sys_core_fold will make them "as literal as
possible". Subsequent rounds can then do the appropriate
optimizations.

/Björn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list