bug in escript and a question

Joe Armstrong erlang@REDACTED
Tue Oct 5 10:30:00 CEST 2010


This escript fails


 +-------------------------------------
    -record(b,{this=that}).

    main(_) ->
       io:format("B=~p~n",[#b{}]),
       halt(1).
  +-----------------------------------

The code is between the lines marked +------

This is what happens

$ escript b 12
b:3: record b undefined
escript: There were compilation errors.

If you add a single blank or comment before the record declartion then it works

 +-------------------------------------
   %% comment
    -record(b,{this=that}).

    main(_) ->
       io:format("B=~p~n",[#b{}]),
       halt(1).
  +-----------------------------------
$ escript b 12
B={b,that}
joe@REDACTED:~/work/c_compiler/bic_current/src$

Now it works

Also -include(..) just doesn't work but -include_lib(...) does.
I cannot think why this should be so - is there any good reason for this?
I can't think of one.

Cheers

/Joe


More information about the erlang-questions mailing list