<div dir="ltr"><div><div><div><div>When defining a fun the shadowing of variables occurring in arguments is inconsistent. So with<br><br></div><span style="font-family:monospace,monospace">a(X, N) -><br></span></div><span style="font-family:monospace,monospace">    fun (<<X,Y:N,_/binary>>) -> {X,Y} end.</span><br><br></div>the X in the fun arguments shadows the X from before it while the N is imported and used. An example:<br><br><span style="font-family:monospace,monospace">1> c(bt).<br>bt.erl:8: Warning: variable 'X' is unused<br>bt.erl:9: Warning: variable 'X' shadowed in 'fun'<br>{ok,bt}<br>2> f(G),G=bt:a(34,8).<br>#Fun<bt.1.1070726><br>3> G(<<1,2,3,4,5>>). <br>{1,2}<br>4> f(G),G=bt:a(34,16).<br>#Fun<bt.1.1070726><br>5> G(<<1,2,3,4,5>>).  <br>{1,515}</span><br><br>Why the difference? Shouldn't we be consistent in shadowing all variables?<br><br></div>Robert<br><br></div>