lua-users home
lua-l archive

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


Jerome Vuarand <jerome.vuarand@gmail.com> dixit:

> Upvalues are references to these "variable" objects. When you access
> the upvalue (by writing "print(t[1])"), you dereference it, and obtain
> the object that the variable points to at that dereferencing moment,
> not when it was created, not when the code was compiled, not when the
> closure was closed.
> 

Yes, think that is the point I was trying to make with unskilled wording. When you mean "variable", there is a _name_ part which doesn't belong to "value.
My interpretation is: A pointer reference (as opposed to symbolic) can only refer to a value (located by address).

2 analogies for the case of symbolice reference (just to make clearer what I try to express):
* symbolic link in unix filesystem (if target where refered to by location, the link would be broken at first file change)
* instance --> class method lookup (inst.m acts as alias for class.m so replacement of class.m will be visible to instances)
In both cases, there are 2 name lookups in tables, while in a pointer reference is a shortcut.

Denis
________________________________

la vita e estrany

http://spir.wikidot.com/