Record definition order in R11-B0 - incompatibility

Rikard Johansson rikard.johansson@REDACTED
Tue May 30 14:28:42 CEST 2006


Hi all, 

The example below works fine in older versions (R9C2 and R10B9 tested)
but fail to compile with R11B0.

$ /usr/local/lib/erlang-R11B0/bin/erlc rtest.erl
./rtest.erl:5: record r1 undefined

The reason is appearently to be that record r1 is referenced before it
is declared, if I swap the two definitions it compiles nicely.

Besides being questionable coding style, is there a way to make this
compile with R11 other than re-writing the code? 

-module(rtest).
-record(r2, {a=#r1{d=1}, b}).
-record(r1, {d, e}).
-export([t/1]).

t(r1) ->
    #r1{};
t(r2) ->
    #r2{}.



Regards, 

/Rikard





More information about the erlang-questions mailing list