|
[snip]
[...] 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.
Hi SteveYes a bit like C include but not, this still has a scope modification. We can define scope with do-end so I was hoping for something that had no scope affect.
Hi JeromeI haven't coded in PHP since finding Lua 2 years ago. It really does seem like a piece of crap now but I love the screw-CS and make it work for regular people approach. I can create a preprocesser now but I sure as hell could not do this when I first meant lua. The language is supposed to be for non-programmers but the all of the discussions about scope fly over the needs of the non-programmer who is left with an odd development environment where code is not easy to split into separate files without great controversy or tediousness. If there is a conflict in goals should not the non-programmers win out over academic high level programming?