fun Name/Arity syntax doesn't work for imported functions

Ulf Norell <>
Tue Jun 22 11:41:09 CEST 2010


The "fun Name/Arity" syntax doesn't take imports into account, requiring
imported
functions to be qualified with their module names.

Example:

---

-module(bug).
-compile(export_all).
-import(lists, [sort/1]).

ok(Xss) ->
  lists:map(fun(Xs) -> sort(Xs) end, Xss).

ok2(Xss) ->
  lists:map(fun lists:sort/1, Xss).

bad(Xss) ->
  lists:map(fun sort/1, Xss).

---

1> c(bug).
./bug.erl:13: function sort/1 undefined

/ Ulf


More information about the erlang-bugs mailing list