[erlang-questions] How about a new warning? Was: Re: trouble with erlang or erlang is a ghetto
OvermindDL1
overminddl1@REDACTED
Fri Aug 19 09:11:38 CEST 2011
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.
On Aug 17, 2011 2:09 PM, "Kenneth Lundin" <kenneth.lundin@REDACTED> wrote:
> I agree that it is very common in test code to match against already bound
> variables.
> But in production code it is quite rare.
> The warning should definitely not be on by default.
> We will also run a check over all OTP libraries and possibly other
> production code
> as well to see how it turns out before we make any definite decisions.
>
> But as said we have not given the implementation any priority at all yet.
>
> /Kenneth
>
> 2011/8/17 Steve Vinoski <vinoski@REDACTED>:
>> 2011/8/3 Frédéric Trottier-Hébert <fred.hebert@REDACTED>:
>>> 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.
>>
>> I completely agree. I use matching this way quite a bit, especially in
>> testing, and wouldn't want to see any warnings for it by default.
>>
>> --steve
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110819/14e2e8dd/attachment.htm>
More information about the erlang-questions
mailing list