lua-users home
lua-l archive

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


Hi,
I also would like to have locals by default. But now it is vice versa.

But why not going  Lua's way  -- meta  mechanisms?  This is  just some
thaught, I don't have the time to try to work it out today, but before
things are   cluttered by a new  :=  assignment, I just would  like to
share it with the list...

Overwrite the "function" tag method  (possibly it is necessary to make
a setglobal tag  method  for   functions to  tweak  them  into  little
tables).  Within the tag method, lock  the globals() table by some tag
method  and allow only  a function global{x1=val1,.. xn=valn} to write
into globals(). 

After locking globals(), call the function to call. Within the function,
"plain" writes into globals generate errors. If we need to write there,
we use the global{} function. Upon return, we clean up things.

But may be, I miss something.


BTW, some standard  library where solutions  of this kind are added to
be shared by the community, would be cool. 





Juergen Fuhrmann


                             Numerical Mathematics & Scientific Computing
               Weierstrass Institute for Applied Analysis and Stochastics
   Mohrenstr. 39 10117 Berlin    fon:+49 30 20372560   fax:+49 30 2044975
http://www.wias-berlin.de/~fuhrmann        mailto:fuhrmann@wias-berlin.de