[ANN] Lua 5.4.0 (alpha-rc2) now available

classic Classic list List threaded Threaded
54 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Andrew Gierth
>>>>> "Roberto" == Roberto Ierusalimschy <[hidden email]> writes:

 >> Right now, my only complain with the <toclose> is the term "close"
 >> that I found a bit vague and over-loaded (conceptually).

 Roberto> Suggestions are welcome.

Egor suggested <resource>. I think Sean Connor's <cleanup> is better,
but to throw out some other random ideas: <unwind> or <onexit>.

--
Andrew.

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Coda Highland


On Wed, Jun 12, 2019 at 12:28 PM Andrew Gierth <[hidden email]> wrote:
>>>>> "Roberto" == Roberto Ierusalimschy <[hidden email]> writes:

 >> Right now, my only complain with the <toclose> is the term "close"
 >> that I found a bit vague and over-loaded (conceptually).

 Roberto> Suggestions are welcome.

Egor suggested <resource>. I think Sean Connor's <cleanup> is better,
but to throw out some other random ideas: <unwind> or <onexit>.

--
Andrew.


+1 to <onexit>. I think I might like it better than <scoped>.

<cleanup> and <unwind> aren't bad.

/s/ Adam
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Doug Currie

On Wed, Jun 12, 2019 at 1:33 PM Coda Highland <[hidden email]> wrote:
On Wed, Jun 12, 2019 at 12:28 PM Andrew Gierth <[hidden email]> wrote:
>>>>> "Roberto" == Roberto Ierusalimschy <[hidden email]> writes:

 Roberto> Suggestions are welcome.

Egor suggested <resource>. I think Sean Connor's <cleanup> is better,
but to throw out some other random ideas: <unwind> or <onexit>.


+1 to <onexit>. I think I might like it better than <scoped>.

<cleanup> and <unwind> aren't bad.

 <autoclose> 

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Russell Haley
In reply to this post by Roberto Ierusalimschy


On Wed, Jun 12, 2019 at 5:46 AM Roberto Ierusalimschy <[hidden email]> wrote:
> Right now, my only complain with the <toclose> is the term "close" that I
> found a bit vague and over-loaded (conceptually).

Suggestions are welcome.

-- Roberto

local <finalize> varname

with a meta method of
__finalize or __finally
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Coda Highland


On Wed, Jun 12, 2019 at 1:02 PM Russell Haley <[hidden email]> wrote:


On Wed, Jun 12, 2019 at 5:46 AM Roberto Ierusalimschy <[hidden email]> wrote:
> Right now, my only complain with the <toclose> is the term "close" that I
> found a bit vague and over-loaded (conceptually).

Suggestions are welcome.

-- Roberto

local <finalize> varname

with a meta method of
__finalize or __finally

That's a little bit ambiguous with the use of a __gc method being called a "finalizer".

/s/ Adam 
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Russell Haley


On Wed, Jun 12, 2019 at 11:37 AM Coda Highland <[hidden email]> wrote:


On Wed, Jun 12, 2019 at 1:02 PM Russell Haley <[hidden email]> wrote:


On Wed, Jun 12, 2019 at 5:46 AM Roberto Ierusalimschy <[hidden email]> wrote:
> Right now, my only complain with the <toclose> is the term "close" that I
> found a bit vague and over-loaded (conceptually).

Suggestions are welcome.

-- Roberto

local <finalize> varname

with a meta method of
__finalize or __finally

That's a little bit ambiguous with the use of a __gc method being called a "finalizer".

/s/ Adam 
Likely why it wasn't suggested by someone else then. 

(face palm) 
Russ
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

nobody
In reply to this post by Coda Highland
On 12/06/2019 19.33, Coda Highland wrote:

>
>
> On Wed, Jun 12, 2019 at 12:28 PM Andrew Gierth
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Egor suggested <resource>. I think Sean Connor's <cleanup> is better,
>     but to throw out some other random ideas: <unwind> or <onexit>.
>
>     --
>     Andrew.
>
> +1 to <onexit>. I think I might like it better than <scoped>.

I think <onexit> will be confusing:  It's not run when you exit the
program but when you leave the current scope.

> <cleanup> and <unwind> aren't bad.

<cleanup>, <unwind>, <scoped> would all be fine for me, with
<unwind>/<scoped> slightly preferred – these two describe the mechanism
/ when stuff happens, not what happens.

"cleanup" is both slightly too wide (not all cleanup happens in <close>)
and slightly too narrow (not everything you might do in <close> is
strictly cleanup, you might also be generating a report / doing stats / …).

<close> is about as good as <cleanup> – acceptable but feels somewhat
imprecise.

-- nobody

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Rodrigo Azevedo
Em qua, 12 de jun de 2019 às 15:45, nobody
<[hidden email]> escreveu:

>
> On 12/06/2019 19.33, Coda Highland wrote:
> >
> >
> > On Wed, Jun 12, 2019 at 12:28 PM Andrew Gierth
> > <[hidden email] <mailto:[hidden email]>> wrote:
> >
> >     Egor suggested <resource>. I think Sean Connor's <cleanup> is better,
> >     but to throw out some other random ideas: <unwind> or <onexit>.
> >
> >     --
> >     Andrew.
> >
> > +1 to <onexit>. I think I might like it better than <scoped>.
>
> I think <onexit> will be confusing:  It's not run when you exit the
> program but when you leave the current scope.
>
> > <cleanup> and <unwind> aren't bad.
>
> <cleanup>, <unwind>, <scoped> would all be fine for me, with
> <unwind>/<scoped> slightly preferred – these two describe the mechanism
> / when stuff happens, not what happens.


What about <catch> and __catch?
It is simple, short and it will be caught when out of scope anyway.


-- Rodrigo

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

nobody
On 12/06/2019 21.24, Rodrigo Azevedo wrote:
> What about <catch> and __catch?
> It is simple, short and it will be caught when out of scope anyway.

<catch> is too exception-y IMHO, suggesting that an error would be
caught while it will actually propagate (and you can't even stop the
propagation from there!)

-- nobody

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Sean Conner
In reply to this post by Russell Haley
It was thus said that the Great Russell Haley once stated:

> On Wed, Jun 12, 2019 at 5:46 AM Roberto Ierusalimschy <
> [hidden email]> wrote:
>
> > > Right now, my only complain with the <toclose> is the term "close" that I
> > > found a bit vague and over-loaded (conceptually).
> >
> > Suggestions are welcome.
> >
> > -- Roberto
> >
> > local <finalize> varname
>
> with a meta method of
> __finalize or __finally

  __finalize was first proposed (as far as I can tell) in 2009:

        http://lua-users.org/lists/lua-l/2009-12/msg00737.html

  __finally is a new one.

  -spc (Why yes, I keep track of proposed metamethods, why do you ask?)

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

pocomane
In reply to this post by Doug Currie


Il mer 12 giu 2019, 16:28 Doug Currie <[hidden email]> ha scritto:
local contents
local f = io.open("myfile")
do
    contents = f:read()
finally
    f:close()
end

Imho this miss the point even more since the closing stuff is very distant from the initialization. What is the difference with just calling "close" at end of the scope?

The intent here is that the code in the `finally` section is called regardless of how the scope is exited: normal exit, exception, coroutine.close, etc.

Ok, you got a point. However it can still be far away from the initialization, being very error prone. Moreover I think it can easily become an "Nesting hell"

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

pocomane
In reply to this post by nobody


Il mer 12 giu 2019, 20:45 nobody <[hidden email]> ha scritto:

I think <onexit> will be confusing:  It's not run when you exit the
program but when you leave the current scope.

> <cleanup> and <unwind> aren't bad.

<cleanup>, <unwind>, <scoped> would all be fine for me, with
<unwind>/<scoped> slightly preferred – these two describe the mechanism
/ when stuff happens, not what happens.

"cleanup" is both slightly too wide (not all cleanup happens in <close>)
and slightly too narrow (not everything you might do in <close> is
strictly cleanup, you might also be generating a report / doing stats / …).

<close> is about as good as <cleanup> – acceptable but feels somewhat
imprecise.

At First I liked <scoped> too. But we are annotating the variables, non the values, and all the variables are already "Scoped". So probably <finalize> or <cleanup> is better. Or maybe <finalizer> since the variable is "Who finalize the value". I do not know if <cleaner> is a proper English word :)


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Egor Skriptunoff-2
In reply to this post by Roberto Ierusalimschy
On Wed, Jun 12, 2019 at 3:46 PM Roberto Ierusalimschy wrote:
Suggestions are welcome.



A name for metamethod: "__scope_exit".
And word-less syntax for to-be-closed variables (some additional punctuation symbols near the variable's name) to avoid unwanted <uglyfication>.
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Daurnimator
In reply to this post by Luiz Henrique de Figueiredo
On Fri, 7 Jun 2019 at 09:34, Luiz Henrique de Figueiredo
<[hidden email]> wrote:
> All feedback welcome. Thanks.

I noticed the new string metamethods: why only
sub,idiv,pow,div,add,mul,unm,mod? Why not the other operators (e.g.
bitwise-and)?
Isn't this a bit of a footgun in regards to types?


Some errors:
lvm.c:1287:9: runtime error: division by zero SUMMARY:
UndefinedBehaviorSanitizer: undefined-behavior lvm.c:1287:9 in
lvm.c:1319:9: runtime error: division by zero SUMMARY:
UndefinedBehaviorSanitizer: undefined-behavior lvm.c:1319:9 in
lvm.c:1291:9: runtime error: division by zero SUMMARY:
UndefinedBehaviorSanitizer: undefined-behavior lvm.c:1291:9 in
lvm.c:1343:9: runtime error: division by zero SUMMARY:
UndefinedBehaviorSanitizer: undefined-behavior lvm.c:1343:9 in

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Roberto Ierusalimschy
> Some errors:
> lvm.c:1287:9: runtime error: division by zero SUMMARY:
> UndefinedBehaviorSanitizer: undefined-behavior lvm.c:1287:9 in
> lvm.c:1319:9: runtime error: division by zero SUMMARY:
> UndefinedBehaviorSanitizer: undefined-behavior lvm.c:1319:9 in
> lvm.c:1291:9: runtime error: division by zero SUMMARY:
> UndefinedBehaviorSanitizer: undefined-behavior lvm.c:1291:9 in
> lvm.c:1343:9: runtime error: division by zero SUMMARY:
> UndefinedBehaviorSanitizer: undefined-behavior lvm.c:1343:9 in

Do you know any real current platform where this is an error?

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Roberto Ierusalimschy
In reply to this post by Daurnimator
> I noticed the new string metamethods: why only
> sub,idiv,pow,div,add,mul,unm,mod? Why not the other operators (e.g.
> bitwise-and)?

We are phasing out coercions from strings to numbers. Removing them
from arithmetic operations would cause a lot of incompatibilities,
but we think (we may be wrong) that its need with bitwise operations
is much more rare. Coercion for bitwise operations is available
through the module 'bwcoercion.lua'.

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Kenneth Lorber
In reply to this post by Luiz Henrique de Figueiredo
Date: Wed, 12 Jun 2019 09:46:19 -0300
From: Roberto Ierusalimschy <[hidden email]>
Subject: Re: [ANN] Lua 5.4.0 (alpha-rc2) now available
To: Lua mailing list <[hidden email]>
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=us-ascii

> Right now, my only complain with the <toclose> is the term "close" that I
> found a bit vague and over-loaded (conceptually).

Suggestions are welcome.

-- Roberto

<onescape>
metamethod __escaped

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Daurnimator
In reply to this post by Roberto Ierusalimschy
On Sat, 15 Jun 2019 at 00:38, Roberto Ierusalimschy
<[hidden email]> wrote:

>
> > Some errors:
> > lvm.c:1287:9: runtime error: division by zero SUMMARY:
> > UndefinedBehaviorSanitizer: undefined-behavior lvm.c:1287:9 in
> > lvm.c:1319:9: runtime error: division by zero SUMMARY:
> > UndefinedBehaviorSanitizer: undefined-behavior lvm.c:1319:9 in
> > lvm.c:1291:9: runtime error: division by zero SUMMARY:
> > UndefinedBehaviorSanitizer: undefined-behavior lvm.c:1291:9 in
> > lvm.c:1343:9: runtime error: division by zero SUMMARY:
> > UndefinedBehaviorSanitizer: undefined-behavior lvm.c:1343:9 in
>
> Do you know any real current platform where this is an error?

It's not so much the platform as what future compiler versions may do.
These divisions by 0 are nasal-demon situations.

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Chris Smith
In reply to this post by Roberto Ierusalimschy

> On 12 Jun 2019, at 13:46, Roberto Ierusalimschy <[hidden email]> wrote:
>
>> Right now, my only complain with the <toclose> is the term "close" that I
>> found a bit vague and over-loaded (conceptually).
>
> Suggestions are welcome.


How about <dispose> ?  It probably fits well with garbage collection, in the sense that you dispose of something by putting it in the garbage, then the garbage is collected.

Regards,
Chris

Chris Smith <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.4.0 (alpha-rc2) now available

Andrew Gierth
>>>>> "Chris" == Chris Smith <[hidden email]> writes:

 >>> Right now, my only complain with the <toclose> is the term "close"
 >>> that I found a bit vague and over-loaded (conceptually).
 
 >> Suggestions are welcome.

 Chris> How about <dispose> ? It probably fits well with garbage
 Chris> collection, in the sense that you dispose of something by
 Chris> putting it in the garbage, then the garbage is collected.

But relating it to garbage collection is probably the wrong way to go -
the object is not actually GC'd as a result.

--
Andrew.

123