[erlang-questions] Dot before call in EUNIT
Richard Carlsson
carlsson.richard@REDACTED
Fri Nov 23 14:39:57 CET 2012
Hi! This artefact is just so that the eunit header file will work also
in modules that use "packages" (experimental, now deprecated, so
eunit.hrl can be updated when packages support is removed from OTP).
/Richard
On 2012-11-23 13:46, Dmitry Klionsky wrote:
> Hi everybody!
>
> I was looking inside eunit.hrl and found a number of defines like this one:
>
> -define(assertMatch(Guard, Expr),
> ((fun () ->
> case (Expr) of
> Guard -> ok;
> __V -> .erlang:error({assertMatch_failed,
> [{module, ?MODULE},
> {line, ?LINE},
> {expression, (??Expr)},
> {pattern, (??Guard)},
> {value, __V}]})
> end
> end)())).
> -endif.
>
> What is interesting for me is the DOT before the call. I've never seen
> it before. I've googled, but found nothing.
>
> Then I grepped:
> /opt/otp-r15b01/lib/erlang/lib $ grep -E ' \.[a-z]+:[a-z]+' ./*/*/*.{e,h}rl
>
> ./eunit-2.2.2/include/eunit.hrl:
> .erlang:process_info(.erlang:group_leader(),
> ./eunit-2.2.2/include/eunit.hrl: __V ->
> .erlang:error({assertion_failed,
> ./eunit-2.2.2/include/eunit.hrl: __V ->
> .erlang:error({assertMatch_failed,
> ./eunit-2.2.2/include/eunit.hrl: Guard ->
> .erlang:error({assertNotMatch_failed,
> ./eunit-2.2.2/include/eunit.hrl: __V ->
> .erlang:error({assertEqual_failed,
> ./eunit-2.2.2/include/eunit.hrl: __X ->
> .erlang:error({assertNotEqual_failed,
> ./eunit-2.2.2/include/eunit.hrl: __V ->
> .erlang:error({assertException_failed,
> ./eunit-2.2.2/include/eunit.hrl: .erlang:error({assertException_failed,
> ./eunit-2.2.2/include/eunit.hrl: .erlang:get_stacktrace()}}]})
> ./eunit-2.2.2/include/eunit.hrl: .erlang:error({assertNotException_failed,
> ./eunit-2.2.2/include/eunit.hrl: .erlang:get_stacktrace()
> ./eunit-2.2.2/include/eunit.hrl: {__N, _} ->
> .erlang:error({command_failed,
> ./eunit-2.2.2/include/eunit.hrl: {__N, _} ->
> .erlang:error({assertCmd_failed,
> ./eunit-2.2.2/include/eunit.hrl: {_, __T} ->
> .erlang:error({assertCmdOutput_failed,
> ./eunit-2.2.2/include/eunit.hrl: .io:fwrite(user, <<"~s:~w:~w:
> ~s\n">>,
>
> So only EUNIT uses this notation. It seems like a historical artifact
> left from ancient times.
> My question is mainly to erlang veterans. What this DOT is/was about?
>
> Best regards,
> Dmitry Klionsky
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list