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

Jeff Schultz jws@REDACTED
Mon Aug 8 09:33:18 CEST 2011

On Fri, Aug 05, 2011 at 10:47:29AM +0200, Richard Carlsson wrote:
> On 08/05/2011 04:22 AM, Jeff Schultz wrote:
>> While I appreciate the intent of Barklund's rule above, I don't think
>> it plays well with Erlang's explicit left-to-right order of
>> evaluation.

> I think you have misunderstood something - or maybe I'm missing something 
> in your reasoning. Barklund's stated rule means that |(X = 8) + X| is just 
> as invalid in Erlang as |X + (X = 8)|, because even though it will work in 
> a left-to-right evaluation order (which is ultimately the order in which 
> the arguments _will_ be executed), it will not work in _any_ evaluation 
> order. The compiler therefore rejects it.

> The nice consequence is that you can always naively reorder the arguments 
> of a function or operator call (in a valid program), because there's no 
> possibility that one affects the variable bindings expected of another.

My point was that in a strict language with side-effects and an
explicit evaluation order, the rule doesn't do anything useful.  It
doesn't, for example, identify any code where the program will "go
wrong" that won't be picked up by the use-before-definition check

    Jeff Schultz

More information about the erlang-questions mailing list