Variable instances (Re: Trace on Variable assignment)

Vance Shipley vances@REDACTED
Thu Nov 9 18:24:41 CET 2000


}  If this is really something which people would like lint to check and 
}  warn I would prefer just to use the variable-name-ending-with-index 
}  convention.  Lint already checks for singeton variables if you ask it, 
}  just use the option 'warn_unused_vars'.  It is, however, a bit of a 
}  sledgehammer.  It ignores variables starting with "_", eg. _Temp.

This pokes at a pet peeve of mine.

When I reverse engineered the AbsForm I wanted to have the code serve to 
document it.  I wanted to match on:

{clause,_Line,[{_Type,_Line,Arg1},{_Type,_Line,Arg2}],_Guard,ClauseList}

I had thought that by prepending an underscore the variable was anonymous.
I quickly learned that it is not, only a single underscore is treated as
anonymous.  I would prefer that any variable with a leading underscore was
treated as anonymous so that the above would work if Arg2 had a different 
line number than Arg1 or the types of the arguments were different.

	-Vance




More information about the erlang-questions mailing list