[erlang-questions] How about a new warning? Was: Re: trouble with erlang or erlang is a ghetto

Frédéric Trottier-Hébert fred.hebert@REDACTED
Wed Aug 3 15:02:57 CEST 2011

On 2011-08-02, at 01:59 AM, Richard O'Keefe wrote:

> 2. Is matching against an already-bound variable a check we want?

To me, matching against an already-bound variable is is a valid assertion, as much as 'ok = function_call()' might be, and as implicit as '{ok, Pid}' or '{error, already_started}' might be. Matching on already-bound variables is part of my standard code when trying to crash early when possible, and also part of many basic test suites that simply do pattern matching here and there. To me it's as basic as using the same variable twice in a single pattern (f([A,A,B,B|_]) when A =/= B -> ...), or something similar with records.

I would likely not use the check at all, and if it were to be added, would prefer it to be a compiler argument (which could be enabled in -compile(...).) I foresee little use of such warnings for myself and would dislike to see it becoming a default setting.

Fred Hébert

More information about the erlang-questions mailing list