Variable instances (Re: Trace on Variable assignment)
Robert Virding
rv@REDACTED
Fri Nov 10 15:55:32 CET 2000
Ulf Wiger <etxuwig@REDACTED> writes:
>
>Thus, I get so many warnings from the linter that the
>'warn_unused_vars' option becomes unwieldy.
>
>In our work on writing design rules, we've never been able to agree on
>a recommendation for "don't care" variables. Some like to annotate
>with underscores, others have tried it, but recoiled in horror when
>they've had to chase down weird pattern-matching bugs (not
>understanding from the start that they were actually binding
>variables). Others, like Peter Lundell, hate "don't care" variables
>(even '_' which is truly "don't care" but doesn't let you clarify
>what kind of variable it should be), and never use them at all.
The same thing happens to me, that is why I called it a sledgehammer. I
very seldom use don't care variables, even the real one, preferring to
always give a variable a name, even if I don't use it. I don't really
like annotating with underscores, although I suppose I could learn if I
wanted to.
It would be difficult to get lint to automatically check chaining of
variables without some proper convention (or syntax). Just doing the
numbers at the end variable names could give very confusing results.
What you would want is some mechanism to automatically fixing the
chaining through a number of calls, like Prolog DCGs, but I haven't seen
a system which is easy to use and can handle many extra variables. They
would probably be very confusing to new users.
Robert
More information about the erlang-questions
mailing list