lua-users home
lua-l archive

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




Am 10.03.2016 um 11:42 schrieb Soni L.:


On 10/03/16 05:09 AM, Thijs Schreijer wrote:
I never thought I'd say this, but I like the way Visual Basic 6 does it:
with foo
     .x = 1
     .y = some_local_var
end with
I don't remember the exact syntax, but the important part is you still
included the dot from foo.x, so that distinguished properties from other
variables in outer scopes.
While reading up the thread, I had the same thought. I also like that about VB.

Thijs
This can be implemented with .name as being a global access. But you'll need to end your lines with a ;.

e.g.

do local _ENV = something;
  .a = 1;
  .b = 2;
end

There was many suggestions for language enhancements but it seems dificult to enhance this simple and neat language. This with-thing is one of the few ideas that make sense while trying to keep lua simple and clean.

Right now we can code somthing in lua that looks similar to a while statement. (We discusses this some time ago about a case statement.)

From my point of view a while statement make sense to calculate a value (a table reference) once and use it many times to save run time. Also the lua source code may become easier to read in some cases. The need to use ";" between statements is no drawback i think. I use this already all the time. (old pascal coder habit) To use whitespaces betwen statements is the one and only lua syntax i dont like.

Ulrich.