lua-users home
lua-l archive

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


From: Reuben Thomas
>>global ; seems best to me, because it doesn't require any changes (and
would
work anyway).

That seems okay. "global ;" reads as "globals to use: none". You could use
"global nil" ?? Probably more confusing?

> I appreciate adding this "use x do ... end" might cause just as many
> problems as this scoping discussion is trying to solve.
>>It's beginning to look like a sort of let x = foo in ... end construct,
familiar to functional programmers.

I was trying to suggest a mechinism for jumping to the scope of a table,
like "use x do ... end" in Pascal (was it use? i havent used pascal for a
while). i think it scans better:
eg.

table1.table2.table3 = { a=1,b=2 }

use table1.table2.table3 do
    local c = a+b
end

vs.

do
  local t = table1.table2.table3
  local c = t.a+t.b
end