lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> I was just glancing at the "Incompatibilities with version 3.2" section of 
> the 4.0 manual, and read the bit that says "The pre-compiler may assume 
> that some operators are associative, for optimizations".
> Is this still the case in 5.0?

Yes. (And not only associative, but commutative, too.)

> If so, is it worth removing? You can always make the optimisation by hand, 
> and it avoids creating hard-to-find bugs in code with non-associative tag 
> methods.

I don't like the idea of optimizing by hand. For instance, what
about  "x = a..b..c..d" and "x = a..(b..(c..d))" ?  Or to translate a
formula "2x+1" as "x*2 + 1" (instead of a more natural "2*x + 1")?

I think that someone that puts a non-associative tag method into '+' is
asking for hard-to-find bugs ;-)

-- Roberto