bad match question
Francesco Cesarini (Erlang Training & Consulting)
Tue Jun 7 17:30:45 CEST 2005
it has to do with the properties of Erlang. Matching is used for three
* Comparison for choice of branch in function / case / receive clauses
* Extraction of data from complex data types
In your example, the first instance is assignment, the second is
comparison. And crashing when a match in a function clause fails is
Erlang's semantical behavior.
A possibility would be a compiler warning (Many were added in R10), but
the code should still compile and execute.
Charles Blair wrote:
> i'm curious why the bad match here isn't caught until runtime:
> start() ->
> Test = [a, b, c],
> Test = [1, 2, 3].
More information about the erlang-questions