Very good question!
The difference is the context. In the first example, Elixir knows FileInfo[]
is being invoked inside a function signature (in particular, inside a match context), and therefore, instead of using the default values, it expands all non-given values to _
.
In the other example, we are not in a match context, it is just the regular context. In this context, _
is not even valid:
iex> _
** (CompileError) iex:1: unbound variable _
In this case, Elixir expands the non-given values to the default ones.