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

Sam Bobroff sam@REDACTED
Thu Jan 7 05:13:11 CET 2010


On 7/01/10 6:32 AM, mog wrote:
> On Wed, Jan 06, 2010 at 02:23:08PM +0100, Tony Rogvall wrote:
>   
>>> I'm simply proposing that if the compiler sees code like:
>>>
>>> measure_secs(Fun) ->
>>>  {_M, S1, _U} = erlang:now(),
>>>  Fun(),
>>>  {_M, S2, _U} = erlang:now(),
>>>  S2 - S1.
>>>
>>> to output something like: "Warning: variable '_U' is not unused".
>>>
>>> Zoltan.
>>>
>>>
>>>       
>> +1
>>     
> ++
> cant tell you how many times i have bit this one as well.
>
>   
For what it's worth, I also support this idea.

(Actually, I was astonished to find that _X was not treated exactly like
_, so that would be my preferred solution. However, issuing the "not
unused" warning is much better than what happens now.)

Sam.

-- 
Sam Bobroff | sam@REDACTED | M5 Networks
Why does my email have those funny headers? Because I use PGP to sign
my email (and you should too!): that's how you know it's really from me.
See: http://en.wikipedia.org/wiki/Pretty_Good_Privacy


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20100107/5c700525/attachment.bin>


More information about the erlang-questions mailing list