[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.4.0 (alpha-rc2) now available
- From: Daurnimator <quae@...>
- Date: Wed, 12 Jun 2019 02:15:08 +1000
On Tue, 11 Jun 2019 at 23:11, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
> Lua 5.4.0 (alpha) will be frozen very soon.
>
> All feedback welcome. Thanks.
I've stayed quiet so far as I've been waiting for the new syntax to grow on me.
However... I can't say it has yet.
- local <const> feels awkward for what should almost be the default
variable type
I see myself wanting to have const variables far more than plain
locals, which
suggests that a *shorter* syntax would be preferable. Several
other languages
have gone with simply `const` (which would replace "local" when
you want to make
a modifiable varible; rather than as a qualifier/attribute)
do
const x = 1
local y = 2
x = "something else" -- error: attempt to assign to const variable
end
- Similarly other languages have `defer` as a similar concept to
"toclose": to try and
shoehorn it into lua: a defer block could run when the current
lexical scope finishes:
local contents
do
local f = io.open("myfile")
defer f:close() end
contents = f:read()
end
- To response to Hisham's suggestion of variable annotations, I do
like the idea;
however I don't think that const nor toclose match what I expect
from annotations.
- I'm unsatisfied with the response to Andrew Gierth's comment about
ensuring that
errors are propagated to the embedder: I think it's crucial to
lua's use as an
embeddable language
I *think* the solution should be that an error in a <toclose>
should be immediately rethrown
and that other <toclose> statements don't get to run.
- Now that lua_gc is a vararg, perhaps LUA_GCCOUNTB could be deprecated?
(instead have a single COUNT opcode that receives two out-args?)
- Could we add a shared library target to the Makefile? I think this
is a reasonable patch:
https://git.archlinux.org/svntogit/packages.git/tree/trunk/liblua.so.patch?h=packages/lua