underscore prefixed variables
Thu Aug 31 22:29:23 CEST 2006
Hakan Mattsson wrote:
> On Thu, 31 Aug 2006, Fredrik Thulin wrote:
> FT> I think that
> FT> a) variables prefixed with "_" should really not be
> FT> variables that get set - like the special case _.
> FT> b) the compiler should issue a warning that you are
> FT> actually using avariable prefixed with "_".
> FT> Would others care to share their view on this?
> I think that it is a splendid idea to have the
> possibility to use anonymous variables with mnemonic
> names. The current semantics is quite error prone. But
> I suspect that there are production code out there that
> is relying on the current behavior.
> Your suggestion to add a new compiler warning should be
> enough. It would give attention to the potential error
> without breaking any existing code.
Enough is enough! Are you going to start complaining when people use _
at all in variables? It could be considered that they really MEANT it to
be a single occurence variable.
This is style and the compiler should not try and enforce a certain
Remove the special handling of variables starting with _ and have a
checker for single occurences which is off by default and let me turn it
on when I get worried.
More information about the erlang-questions