lua-users home
lua-l archive

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


On 19/10/2011 14.48, Patrick Mc(avery wrote:
On 11-10-19 08:42 AM, Enrico Colombini wrote:
On 19/10/2011 13.54, Patrick Mc(avery wrote:
If Python runs something in 200ms and Lua runs it in 50ms I don't care,
it's still a blink of an eye.

In a game environment, for example, 1 ms per frame could be way too
much. Same thing for memory, in many embedded applications.

I fail to understand this drive to "let's change Lua to make it the
same as any other generalist language".

Hi Enrico

Actually I don't want to change Lua per say, it's just that with all the
module discussion I feel that a large part of the list is arguing for
the wrong sort of things. I think that there should be more attention
paid to making it simpler to use. Perhaps that puts me in the
anti-module camp but if it does, I don't think the revision goes far
enough to bring it to the easy of use of python/import, PHP/include.

Again I don't understand the internals and if this sort of thing will
cause too much overhead then it's pointless as Lua has to find some safe
space between the fat/feature-rich languages.



Hi Patrick!

You proposed to add a text-based include mechanism to lua arguing it will make it easier for non-programmers (if I got it right - I got lost in this thread so sorry for any misunderstanding).

I disagree very strongly with this proposal and with the argument that it will make Lua easier for non-programmers.

I don't know PHP but from other posts it seems very similar to the #include directive of C preprocessor. If this is true, I don't think it will make Lua *so* easier.

Text-based inclusion is a powerful mechanism if used (very) carefully by experienced programmers, but also a (very) messy one. Newbies will indeed have an easier time to understand *how* it works, but most probably won't understand all the implications of its use and *how to use it correctly*, except for the most trivial tasks.

But once the newbie gains more experience, will probably want to use that mechanism for more advanced use (and will try all the dirty tricks a future programmer has done when evolving from the non-programmer stage!), and then they will get hurt badly.

Code written using "include tricks" *will* come and haunt you in the future (unless you are an experienced programmer - hopefully!), and is difficult to maintain.

Of course if you only write throwaway scripts this could be bearable, but then you are proposing a change that will hurt every non-programmer that wants to become a programmer (I'm oversimplifying - I know).

The point, as collectively the list has tried to communicate (as usual in its sometimes chaotic way), is that text-based inclusion is bad because it doesn't fit Lua spirit: it is messy, it doesn't play well with scoping rules (even non-programmers should know the benefits of structured programming - it's not advanced CS - it's basic programming methodology - and scoping is central to structured programming), it is not orthogonal.

In short, it won't make Lua easier, but harder to understand once you want to do more that the most basic things.

You said, IIRC, that it will simplify typing code, but this is hardly ever a good reason to add a feature to a language: programs should be easy to *read*, typing is secondary (as Steve Donovan pointed out, a good editor/IDE could help a lot for that). Again, this is a basic programming principle, not advanced CS.

C has this feature (in its preprocessor - not the language itself) but keep in mind that:

1. C is an old language (70s IIRC): it was designed when machines where *much* less powerful than today (so more advanced features were too costly) and there were *much* less non-programmers toying with computers.

2. it was meant to build system software (an entire OS - Unix!). It was an higher-level replacement for assembly language!

OTOH Lua has proven quite successful for non-programmers (as WoW modders know). Its success comes also from its small size (in the sense that there are few feature to understand) and the absence *apparently* easy features. Easy features are, more or less, just that - easy (there are gotchas - of course - but not so many for simple things).

Most gotchas come up when you start using advanced features, such as OOP, closures, metatables, etc.

Please, bear in mind that the beauty of Lua (and its ease of use) comes also from its carefully balanced design - there are tradeoffs, but they are well thought-out.

IIRC you said you are a non-programmer (sorry if I got this wrong, as I said I was overwhelmed by this thread and its spawns), so please trust all the good programmers on this list when they say that text-based inclusion is not a good thing *in general*. And this has almost nothing to do with performance, but with code clarity, readability and maintainability.

Cheers.
-- Lorenzo