the problem of using _Var instead of _
Richard A. O'Keefe
ok@REDACTED
Sun Mar 6 22:57:56 CET 2005
Bengt Kleberg <bengt.kleberg@REDACTED> wrote:
i have operated under the assumption that _ and _<Var> are the
same for over four years now.
The language description made it quite clear that this is not so.
In ML, CAML, Haskell, Clean, Prolog, Mercury, and Erlang, in fact
in _all_ the programming languages I've used which have pattern
matching standardly built into their procedure-calling machinery,
"anonymous variable" syntax gives you a new distinct variable
each time you use it, while this is not true for any other kind of
variable, no matter how spelled.
Variable name New each Warn if Warn if
matches regexp time? =1 occ? >1 occ?
/_/ yes no no
/_[a-zA-Z0-9_]+/ no no no[%]
/[A-Z][a-zA-Z0-9_]*/ no yes no
[%] It looks as though there _should_ be a warning.
More information about the erlang-questions
mailing list