lua-users home
lua-l archive

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


On 18 July 2018 at 17:19, Roberto Ierusalimschy <roberto@inf.puc-rio.br> 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.
 
None of these things are compelling me to reject scope-qualified locals as a very versatile and useful mechanism

On Wed, Jul 18, 2018 at 11:55 AM Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
It is not by chance that Lua avoids too many syntactical constructs.
They are hard to be represented in the C API.

(I was considering suggesting dynamic-wind, or unwind-protect from Lisp, but ...)
This is a powerful argument, and convinced me that a new language construct is not the answer. 

e

On Wed, Jul 18, 2018 at 1:13 PM Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
On 18 July 2018 at 17:19, Roberto Ierusalimschy <roberto@inf.puc-rio.br> 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.
>

Perhaps something simpler could be done? Such as ask a function to be
called on scope exit (normally or via exception) - similar to defer
statement in Go?

Then user code can do what it likes in that function - responsibility
of Lua ends with invoking the function.

Regards
Dibyendu