On Wed, Jul 18, 2018 at 9:19 AM Roberto Ierusalimschy <email@example.com> wrote:We had something (scope-qualified locals) that seemed to be enough.
Now we have this list of problems:
- It does not create a new scope by itself;
- It is not visible enough;
- It still does not solve the problem for global variables;
- It cannot supress exceptions.The better is the enemy of the good here. I've seen many programs that leak memory, even though they were written in a language that uses a garbage collector (forgot to set that object member to nil?). Garbage collection is a 95% solution, you have to know how it works and sometimes you have to tweak things.The problem of leaking resources is a real one, and the implementation of a generational garbage collector in Lua 5.4 may make them worse by making the object owning the resource extremely long-lived once it leaves the nursery. Scoped locals, a "with ... as" clause, or an equivalent construct can make the programmer's job easier, but there is no 100% solution. A 100% solution would solve the halting problem :-)Gé----Gé