lua-users home
lua-l archive

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


Well, for the years of using Pascal (and, last years, Delphi) I developed a
strong liking of "with" and strong dislike of its absence in other
languages. Well, it *may*, of course, introduce some complications, but it
saves time if you know what you are doing. Its just a proposal of syntax for
explicit scope change, I think it would be much more readable (and, I think,
safe) to have such construct as, for example, a syntactic sugar for
temporarily changing global environment.
Well, any way, its just a suggestion, nothing more. Since Lua already has
pascal-like syntax, why not take one more construct from there? ;-)
Slightly off-topic: for me the main difference between Pascal and Lua syntax
is = and ==, thanks god (and the authors of Lua) that assignment does NOT
return a value and using = in "if" causes a syntax error :)

----- Original Message -----
From: "David Olofson" <david@olofson.net>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Sunday, June 01, 2003 5:22 AM
Subject: Re: Object Oriented Lua scope?


On Sunday 01 June 2003 00.41, Deneb aka Alpha Cygnus wrote:
> it would really be nice if one could type something like this:
> x = {}
> with x do
>   a=3
>   b=5
>   c="this is x.c"
> end
>
> print(x.a+x.b) --> 8

I've developed a strong dislike for that construct when doing Delphi
(Object Pascal) development. Considering that it's just syntactical
sugar, it's rather expensive, in my experience. Too much risk of
misreading code, and of writing code that doesn't do what think it
does. Evil.


//David Olofson - Programmer, Composer, Open Source Advocate

.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---