[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: proposal (RE: Making vars local by default)
- From: "Russell Y. Webb" <rw20@...>
- Date: Thu, 31 May 2001 15:06:05 -0700
> If these two pieces (the global only write mechanism and the global_write
> switching function, the later could be written in Lua but would be nice to
> have as part of the standard so we would have to find it or have different
> versions of it) were part of Lua then those who didn't need them would only
> have to deal with reading code that used the global-only-write mechanism
> (which is a strong argument for making it obvious, := not being at all
> obvious).
>
> In this world both styles of coding happily coexist. One can easily get
> into a state that global_write is in the wrong state, but if the code that
> uses the global write mechanism has *ever* been run with global_write(false)
> then there's no problem. That's my suggestion.
OK. I goofed, that will not work. Problem is that if a function written in
the current Lua style gets executed with global_write(true) then it fails.
So there's no way to make the old style code function in the
global_write(false) world without keeping up with which mode each function
was compiled in.
Keeping up with the minority case (be it global-writes enabled or disabled)
wouldn't be too bad but would add to memory usage and incur at least one
table look up per call.
In conclusion, it would help unify the models at least from one perspective
to have a standard method for explicit global-only writes.
Russ