Reputation: 145
The correct option for debug information is debug_info
:
1> compile:file(hello, [debug_info, export_all]).
{ok,hello}
On the other hand, what I don't understand is why the compilation is always successful, also when passing non-existing options?
For example
2> compile:file(hello, [debug, export_all]).
{ok,hello}
or
3> compile:file(hello, [foobar, export_all]).
{ok,hello}
Why these two examples do not report error ?
Upvotes: 2
Views: 65
Reputation: 4507
It is common in Erlang to ignore invalid options. Options are fetched with defaults. Something like this:
1> Opts = [{opt1, 1}, {other, 2}].
[{opt1,1},{other,2}]
2> %% Inside function
2> Opt1 = proplists:get_value(one, Opts, 1),
2> Opt2 = proplists:get_value(two, Opts, 2).
2
3> Opt1.
1
4> Opt2.
2
5>
Upvotes: 2