Skip to content

Lua 5.5.0 initial fixes#661

Open
michaeam wants to merge 4 commits intopallene-lang:masterfrom
michaeam:dev_5.5.0
Open

Lua 5.5.0 initial fixes#661
michaeam wants to merge 4 commits intopallene-lang:masterfrom
michaeam:dev_5.5.0

Conversation

@michaeam
Copy link
Copy Markdown

Trivial test, i.e. by far not complete:

$ pallenec --emit-lua examples/arithmetic/arithmetic.pln
$ $ cat examples/arithmetic/arithmetic.lua
-- Copyright (c) 2020, The Pallene Developers
-- Pallene is licensed under the MIT license.
-- Please refer to the LICENSE and AUTHORS files for details
-- SPDX-License-Identifier: MIT

local m = {}

function m.add(a, b)
    return (a) + (b)
end

function m.subtract(a, b)
    return (a) - (b)
end

return m

* Language version must match exactly
* Loop variables in Lua >=5.5 are RO (fix)
* Rockspec permit build with Lua 5.5
Naive and probably needs better solutions instead of work-abounds but
seems to work
@michaeam michaeam marked this pull request as draft April 20, 2026 08:53
@michaeam michaeam marked this pull request as ready for review April 20, 2026 08:54
Copy link
Copy Markdown
Member

@hugomg hugomg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks promising!

I'll wait until we sort out the lua-internals PR before we run this through the CI. The CI won't work unless that other PR is merged first.

Comment thread src/pallene/C.lua
line = line:match("^%s*(.-)%s*$")
local line
for _line in input:gmatch("([^\n]*)") do
line = _line:match("^%s*(.-)%s*$")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we declare the variable inside the for loop?

for _line in input:gmatch("([^\n]*)") do
    local line = _line:match("^%s*(.-)%s*$")

Comment thread pallene-dev-1.rockspec
}
dependencies = {
"lua == 5.4",
"lua >= 5.4, < 5.6",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be exactly 5.5.

In fact, if Luarocks allowed it, we would specify the minor patch 5.5.0. Pallene is only compatible with one specific minor patch at a time, because we rely on internal APIs that can break even in a minor patch.

} else {
return cast(TValue *, luaH_getstr(t, key));
TValue idx;
return cast(TValue *, luaH_getstr(t, key, &idx));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks sketchy. luaH_getstr now returns a lu_byte instead of a pointer. It probably makes no sense to cast the return value to TValue* ?

We need to look closer into this, but its possible that this API change is related to the 5.5 changes to the internal representation of arrays, which now stores the TValue tag separately from the payload. https://sol.sbc.org.br/index.php/sblp/article/view/30252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants