lua-users home
lua-l archive

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


>From lua-l@tecgraf.puc-rio.br Tue Jul 13 02:59:53 1999
>From: Dave Bollinger <DBollinger@compuserve.com>

>   Back in the list archives there are several threads about pointer
>aliasing, caching pointers to objects, and such - essentially describing
>the functionality of Pascal's "with" statement.

There's no way this can work given Lua's table semantics: there's no notion
of a field being present in a table, because tables are dynamic.
In other words, there's no way you can "test" whether "v" may refer to a field
in a table and not to a global variable, because it's legal to write t.v.
So,
	with t do
		w=a
		v=20
	end
would not work. Which of the three a,v,w are global?

unless you write something like:
	with t do
		.w=a
		.v=20
	end
(which is ambiguous because it conflict with w=a.v)
Plus, if you're writing .w, why not write t.w?
--lhf