<html><head></head><body>That's definitely an option, however name generation may be difficult in some cases.<br>The one I always have problems with is filling cowboy response by calling a cascade of functions updating request structure progressively. I'm not sure if other developers prefer typing ReqWithHeaders, ReqWithContentType, ReqWithBody, ReqHalted to consecutive but otherwise meaningless numbers.<br><br><div class="gmail_quote">On 28 January 2020 9:04:38 am AEDT, Robert Raschke <rtrlists@googlemail.com> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">On Mon, 27 Jan 2020 13:22 Mikael Pettersson, <<a href="mailto:mikpelinux@gmail.com">mikpelinux@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Since Erlang doesn't allow you to rebind a variable in a scope where it's already bound (that becomes a match instead), there is a convention of using numbered variables to denote successive "generations" of some object or state that's intended to be used in a single-threaded or linear way.  For example:<div><br></div><div>foo(X0) -></div><div>  X1 = update(X0),</div><div>  case predicate(X1) of</div><div>    true -></div><div>      X2 = another_update(X1),</div><div>      persist(X2);</div><div>    false -></div><div>     persist(X1)</div><div>  end.</div><div><br></div><div>Here, whenever X(N+1) becomes bound, X(N) should become unused, and it should be an error if X(N) did not become unused.  A variation is that the "final" value is the one without a number suffix.</div><div><br></div><div>Is there any Erlang linter or style checker that can perform these types of checks?</div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">For what it's worth, I consider this practice a bad code smell. Using numbered names like that is lazy. Usually such code can be radically improved upon by using names that properly describe the values they represent. Very often doing this will start you on the path to simpler code that ends up not requiring this kind of incremental buildup of "stuff".</div><div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto">Robby</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>
</blockquote></div><br>-- <br>Kind regards,<br>Dmitry Belyaev</body></html>