lua-users home
lua-l archive

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


Thanks for the well thought out reply.  I'll try to look through your 
code this afternoon.

> Now imagine the mess of having to write
> 
> 	global fgcolor="red"
> 	global bgcolor="white"
> 	global tolerance=0.001
> 
> This seems quite verbose and useless, from the point of view of the end user.
> So the decision of having globals by default makes sense to us ;-) and
> we don't feel we need to change it.
> Moreover, we cannot change it without breaking *lots* of Lua code.

Sorry I wasn't clear.  I'm suggesting a change that would only change
global access within a "method...end'' block.  It wouldn't break any code,
but it would make Lua more capable of supporting different programming
methods and goals.  I really love Lua and respect all the design choices
that went into it.  For my needs, having a default-to-local access block
for functions would be of great help.  I'd add it to the language myself,
but I haven't yet been able to unravel the mystery that is the parser. 

To summarize my suggestion:
1. within a method...end block, all variable access and assignment is 
   assumed to be local 
2. the global keyword (only needed inside method...end) means, the
   very next word is a global variable name

Seems simple enough to me.  If I could get some pointers on how to add it
myself (is there a lex file we don't have?), I'd be happy to produce an
experimental Lua (not for distribution of course) so we could try it
out. 
 
> Really? Do semi-technical users prefer/understand local variables??

I should have called them technical people who aren't serious 
programmers.  The type who run plasma etchers and program RPN calculators.

Thanks,
Russ