An over enthusiastic warning ?

Roger Price rprice@REDACTED
Tue May 23 22:53:34 CEST 2006


The following code was produced by a compiler [1] which replaced unused 
variables U4 and U5 by wildcards,

  fun ([_U4|_U5]) ->
      fun ([_U4|_U5]) ->        %% Warnings for wildcards _U4 and _U5
          fun ([U4|U5]) ->
              fun ([U6|U7]) -> {'C',U1,U4,U5,U6,U7}
              end(U3)
          end(U2)
      end(U3)
  end(U2)

but the Erlang (BEAM) emulator version 5.4.9 [source] [hipe] with Eshell 
V5.4.9 issued warnings:

./test0.erl:25: Warning: variable '_U4' shadowed in 'fun'
./test0.erl:25: Warning: variable '_U5' shadowed in 'fun'

It seems to me that these warnings should have been suppressed in view of 
the leading "_".

Roger

[1] An implementation of the Augustsson/Wadler pattern matching compiler 
described in chapter 5 of "The implementation of functional programming 
languages" by Simon L Peyton Jones.



More information about the erlang-questions mailing list