I think in macros, that is true, but not for lists, maps, or other collections. So that would be one thing consider if that is the case.
EDIT: The code examples in my first post all execute successfully in IEx.
Indeed, a macro with a trailing comma will raise a compilation error. For example, this code:
defmodule HelloPhoenix.Repo do
use Ecto.Repo,
otp_app: :hello_phoenix,
adapter: Ecto.Adapters.Postgres,
# ...
end
produces this error:
Compiling 1 file (.ex)
== Compilation error in file lib/hello_phoenix/repo.ex ==
** (SyntaxError) invalid syntax found on lib/hello_phoenix/repo.ex:4:36:
error: unexpected expression after keyword list. Keyword lists must always come as the last argument. Therefore, this is not allowed:
function_call(1, some: :option, 2)
Instead, wrap the keyword in brackets:
function_call(1, [some: :option], 2)
Syntax error after: ','
│
4 │ adapter: Ecto.Adapters.Postgres,
│ ^
│
└─ lib/hello_phoenix/repo.ex:4:36


















