[erlang-questions] Compiler to warn on used underscore-variables

Zoltan Lajos Kis kiszl@REDACTED
Wed Jan 6 16:20:21 CET 2010


> Zoltan Lajos Kis wrote:
>>
>> I understand that they are ordinary variables. But I am certain that all
>> the _Var variables I have seen so far were named so in order to indicate
>> that they are intentionally unused, and not because of some strange
>> naming
>> habit.
>
> It is also useful in generated code, take a look at the output of yecc
> for an example.
>
>
> Laszlo
>

I never had a chance to dive into yecc, but from what I have seen, it
seems that prepending everything with "__" is an odd way of (not) applying
the nowarn_unused_vars switch. Regarding functionality it could pretty
much prepend everything with "XYZ123" instead of "__".

Anyway, what I proposed could be a switchable feature, so by default it
would be off, and whoever likes it, turns it on.

The main question is whether it is hard to implement or not. My guess is
not, as the "opposite" functionality is already there. But this can be
plain wrong.

Zoltan.



More information about the erlang-questions mailing list