lua-users home
lua-l archive

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


2011/10/18 Patrick Mc(avery <patrick@spellingbeewinnars.org>:
> [...]
>
> I don't want to have to [...], on the other end I don't want to have to [...]

Basically, you want to do something, there is a way to do it in Lua,
but you don't *want* to do it that way. I agree it would be nice if
the Lua authors did realize every one of our wishes, but given the
size of the community, it's impossible (because we have conflicting
wishes). I don't want to defend the status quo and prevent any change
in the language, but the reasons you give about the superiority of the
PHP (basically its simplicity) are very subjective.

> PHP is a poorly constructed language but include just switches
> execution from one file to the other and then goes back to the first

Isn't PHP a poorly constructed language precisely because of such
mis-features? As others have pointed that feature would mess the
beautiful consistency of Lua in respect to scoping rules.

2011/10/18 Patrick Mc(avery <patrick@spellingbeewinnars.org>:
> [...] Other
> languages have this simple-PHP like mechanism, it's not about encapsulation
> it's just about typing. This example was short but why could someone not
> define 100 local variables and then when the include is called from within a
> function, those locals become local to that function as if they were typed
> inside it.

Some languages, like C or C++, use a preprocessor to implement such
features. The compiler itself takes its translations units whole and
consistent, just like Lua. I believe you can use existing
preprocessors (m4, gcc -E, etc.) and apply them to Lua source files.