lua-users home
lua-l archive

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


On Jul 25, 2012, at 5:09 PM, Coda Highland wrote:

> On Wed, Jul 25, 2012 at 2:02 PM, Dimiter 'malkia' Stanev
> <malkia@gmail.com> wrote:
>> -- "function() end" would gurantee an unique value, differentiated from
>> others, unless the VM merges it under one umbrella. Even them, maybe reusing
>> coroutine might return you an unique value for the lifetime of the
>> application (or something even simpler)
> 
> Unless I miss my guess, the VM couldn't merge it because they'd have
> different upvalues.

There are no free variables in function() end and hence no upvalues, so it certainly could be merged/hoisted to chunk level.

Use NULL={} instead. List constructors guarantee uniqueness.