[erlang-questions] Reassigning variables
Richard O'Keefe
ok@REDACTED
Mon Mar 23 03:17:49 CET 2009
On 18 Mar 2009, at 7:07 pm, Matthew Dempsky wrote:
> Also, here's a list of a few other functions in OTP that use numbered
> variables:
>
> - erl_lint:post_traversal_check/2
This one is
post_traversal_check(Forms, St0) ->
St1 = check_behaviour(St0),
St2 = check_deprecated(Forms, St1),
St3 = check_imports(Forms, St2),
St4 = check_inlines(Forms, St3),
St5 = check_undefined_functions(St4),
St6 = check_unused_functions(Forms, St5),
St7 = check_bif_clashes(Forms, St6),
St8 = check_specs_without_function(St7),
St9 = check_functions_without_spec(Forms, St8),
StA = check_unused_types(Forms, St9),
StB = check_untyped_records(Forms, StA),
check_unused_records(Forms, StB).
which would be easier maintained as
post_traversal_check(Forms, St) ->
check_unused_records(Forms,
check_untyped_records(Forms,
check_unused_types(Forms,
check_functions_without_spec(Forms,
check_specs_without_function(
check_bif_clashes(Forms,
check_unused_functions(Forms,
check_undefined_functions(
check_inlines(Forms,
check_imports(Forms,
check_deprecated(Forms,
check_behaviour(
St)))))))))))).
It would be even better if all the check_* functions had the
same (Forms, St) -> St' interface, and we could do the
fold-over-function-list trick.
More information about the erlang-questions
mailing list