[erlang-bugs] Call with a tuple as a module succeeds in Erlang 18 RC2
Stavros Aronis
aronisstav@REDACTED
Wed May 27 13:40:11 CEST 2015
Hello!
It seems that there are some leftovers from the parameterized modules
support in the compiler for Erlang 18 RC2 (and also earlier Erlang
versions). In the example below, even though the compiler emits warnings
when a tuple is used as a module name, the code executes without error.
Requesting HiPE compilation restores the 'correct' behaviour (an error is
raised).
Regards,
Stavros
---
$ cat tuple_as_module.erl
-module(tuple_as_module).
-export([test/0, action/2]).
test() ->
P = {?MODULE, [1,2,3]},
{P:action(head),
P:action(tail)}.
action(head, {?MODULE, List}) ->
hd(List);
action(tail, {?MODULE, List}) ->
tl(List).
$ erl
Erlang/OTP 18 [RELEASE CANDIDATE 2] [erts-7.0] [source] [64-bit] [smp:8:8]
[async-threads:10] [hipe] [kernel-poll:false]
Eshell V7.0 (abort with ^G)
1> c(tuple_as_module).
tuple_as_module.erl:7: Warning: invalid module and/or function name; this
call will always fail
tuple_as_module.erl:8: Warning: invalid module and/or function name; this
call will always fail
{ok,tuple_as_module}
2> tuple_as_module:test().
{1,[2,3]}
3> c(tuple_as_module, [native]).
tuple_as_module.erl:7: Warning: invalid module and/or function name; this
call will always fail
tuple_as_module.erl:8: Warning: invalid module and/or function name; this
call will always fail
{ok,tuple_as_module}
4> tuple_as_module:test().
** exception error: bad argument
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20150527/b786edf6/attachment.htm>
More information about the erlang-bugs
mailing list