<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div><span>The way I see it, the feature of implicit variable matching is more trouble than it's worth. Warnings about such matches would catch this kind of problems.<br></span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;">For myself, it's seldom used in practice, and mostly a source of hidden bugs and unobvious code. Rewriting into explicit comparisons is normally straightforward and clearer, so having it doesn't buy me a lot. But maybe I'm
being unreasonable. Anyone use bound variables in patterns a lot by intent?</div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="background-color: transparent;"><br></span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="background-color: transparent;">Best,</span><br></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span>Thomas</span></div><div class="yahoo_quoted" style="display: block;"> <br> <br> <div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
Grande', sans-serif; font-size: 10pt;"> <div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> On Wednesday, March 5, 2014 4:57 PM, Anthony Ramine <n.oxyde@gmail.com> wrote:<br> </font> </div> <blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"> <div class="y_msg_container">Why would you warn for this? It’s a feature.<br clear="none"><br clear="none">-- <br clear="none">Anthony Ramine<br clear="none"><div class="yqt2983793536" id="yqtfd94733"><br clear="none">Le 5 mars 2014 à 16:38, Thomas Lindgren <<a shape="rect" ymailto="mailto:thomasl_erlang@yahoo.com" href="mailto:thomasl_erlang@yahoo.com">thomasl_erlang@yahoo.com</a>> a écrit :<br clear="none"><br clear="none">> Occurrences of bound variables in patterns. For example A, B, C, and D in these:<br
clear="none">> <br clear="none">> {A, B} = f(X),<br clear="none">> {A, B} = f(Y), % A,B already bound<br clear="none">> C = g(Z),<br clear="none">> C = g(W), % C is already bound<br clear="none">> {D,D} = h(V) % D is bound then matched<br clear="none">> <br clear="none">> Best,<br clear="none">> Thomas<br clear="none">> <br clear="none">> <br clear="none">> <br clear="none">> On Wednesday, March 5, 2014 3:39 PM, Anthony Ramine <<a shape="rect" ymailto="mailto:n.oxyde@gmail.com" href="mailto:n.oxyde@gmail.com">n.oxyde@gmail.com</a>> wrote:<br clear="none">> What would you like to be warned about? I don’t get it.<br clear="none">> <br clear="none">> -- <br clear="none">> Anthony Ramine<br clear="none">> <br clear="none">> Le 5 mars 2014 à 15:33, Thomas Lindgren <<a shape="rect"
ymailto="mailto:thomasl_erlang@yahoo.com" href="mailto:thomasl_erlang@yahoo.com">thomasl_erlang@yahoo.com</a>> a écrit :<br clear="none">> <br clear="none">> > Thanks Anthony, that option warns for Value in the previous example because it's exported from the case, but not for the variable match that then occurs. I'd like to see a compiler option that warned about matching (bound variables occurring in patterns), which would catch other inadvertent reuse of variable names.<br clear="none">> > <br clear="none">> > Best,<br clear="none">> > Thomas<br clear="none">> > <br clear="none">> > <br clear="none">> > On Wednesday, March 5, 2014 2:40 PM, Anthony Ramine <<a shape="rect" ymailto="mailto:n.oxyde@gmail.com" href="mailto:n.oxyde@gmail.com">n.oxyde@gmail.com</a>> wrote:<br clear="none">> > The compile option is warn_export_vars:<br clear="none">> > <br clear="none">> >
Causes warnings to be emitted for all implicitly exported variables referred to after the primitives where they were first defined. No warnings for exported variables unless they are referred to in some pattern, which is the default, can be selected by the option nowarn_export_vars.<br clear="none">> > <br clear="none">> > -- <br clear="none">> > Anthony Ramine<br clear="none">> > <br clear="none">> > Le 5 mars 2014 à 12:18, Thomas Lindgren <<a shape="rect" ymailto="mailto:thomasl_erlang@yahoo.com" href="mailto:thomasl_erlang@yahoo.com">thomasl_erlang@yahoo.com</a>> a écrit :<br clear="none">> > <br clear="none">> > > In the larger scheme of things: The way I see it, the feature of implicit variable matching is more trouble than it's worth. Warnings about such matches would catch this kind of problems.<br clear="none">> > > <br clear="none">> > <br clear="none">> > <br
clear="none">> <br clear="none">> <br clear="none"></div><br><br></div> </blockquote> </div> </div> </div> </div></body></html>