lua-users home
lua-l archive

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


I can't agree here. Without a clear deterministic definition of the language it can be basically impossible to determine what your program does. It also becomes impossible to reason about. This I feel can be worth some optimisation. It also means that to *be* certain can mean your program becomes longer, For example I want A to be evaluated before B inside some expression so I first explicitly do A and save the value in a variable then evaluate B and save its value in a variable. For a language like Lua which has side-effects this can be critical.

For the case of a table constructor it would be easy to define everything as going left-to-right. Create the table and evaluate and insert the key/values left-to-right. Yes you might overwrite an existing value but at least you know in which order they were inserted. The example in the 5.2 manual page 18 implies this but it is never explicitly stated.

Robert

----- Original Message -----
> On Sat, Apr 21, 2012 at 17:06, Mark Hamburg
> <mhamburg.lists@gmail.com> wrote:
> > It is defined. It just isn't deterministically defined. And leaving
> > flexibility in the language definition can be
> > a key part of how one allows for optimization.
> 
> Wholeheartedly agree, provided that the manual clearly spells it out.
> 
> --Leo--
> 
>