<p>Not so rare in my production code for note, I use it heavily in a few of my math oriented modules and would not want it on by default. I have personally not yet been bit by the bug that the warning would prevent in my few years in erlang, although I have other functional backgrounds.</p>
<div class="gmail_quote">On Aug 17, 2011 2:09 PM, "Kenneth Lundin" <<a href="mailto:kenneth.lundin@gmail.com">kenneth.lundin@gmail.com</a>> wrote:<br type="attribution">> I agree that it is very common in test code to match against already bound<br>
> variables.<br>> But in production code it is quite rare.<br>> The warning should definitely not be on by default.<br>> We will also run a check over all OTP libraries and possibly other<br>> production code<br>
> as well to see how it turns out before we make any definite decisions.<br>> <br>> But as said we have not given the implementation any priority at all yet.<br>> <br>> /Kenneth<br>> <br>> 2011/8/17 Steve Vinoski <<a href="mailto:vinoski@ieee.org">vinoski@ieee.org</a>>:<br>
>> 2011/8/3 Frédéric Trottier-Hébert <<a href="mailto:fred.hebert@erlang-solutions.com">fred.hebert@erlang-solutions.com</a>>:<br>>>> On 2011-08-02, at 01:59 AM, Richard O'Keefe wrote:<br>>>><br>
>>>> 2. Is matching against an already-bound variable a check we want?<br>>>><br>>>> To me, matching against an already-bound variable is is a valid<br>> assertion, as much as 'ok = function_call()' might be, and as implicit as<br>
> '{ok, Pid}' or '{error, already_started}' might be. Matching on<br>> already-bound variables is part of my standard code when trying to crash<br>> early when possible, and also part of many basic test suites that simply do<br>
> pattern matching here and there. To me it's as basic as using the same<br>> variable twice in a single pattern (f([A,A,B,B|_]) when A =/= B -> ...), or<br>> something similar with records.<br>>>><br>
>>> I would likely not use the check at all, and if it were to be added,<br>> would prefer it to be a compiler argument (which could be enabled in<br>> -compile(...).) I foresee little use of such warnings for myself and would<br>
> dislike to see it becoming a default setting.<br>>><br>>> I completely agree. I use matching this way quite a bit, especially in<br>>> testing, and wouldn't want to see any warnings for it by default.<br>
>><br>>> --steve<br>>> _______________________________________________<br>>> erlang-questions mailing list<br>>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
>> <a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br>>><br></div>