lua-users home
lua-l archive

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


> On Jul 8, 2015, at 12:35 PM, Parke <parke.nexus@gmail.com> wrote:
> 
> On Wed, Jul 8, 2015 at 11:34 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>> Similarly:
>> 
>> a = c
>> 
>> would be generate "attempt to assign a constant object to
>> a non-constant name", but
>> 
>> const a = c
>> 
>> would be OK.
> 
> So if a function returned a tuple (or any other constant value), you
> would also need to declare that the function returned a constant
> value, so that the interpreter could know and generate appropriate
> compile time errors?
> 
> -Parke
> 

 Except checking this kind of thing at compile time is very expensive, as it requires flow analysis and all sorts of other nasty (=expensive) processing. Trying to declare variables (rather than values) as const is fraught with difficulties, hence my post about making this a property of a value.

—Tim