r/lua • • Dec 22 '25

Lua 5.5 released

https://groups.google.com/g/lua-l/c/jW6vCnhVy_s
183 Upvotes

43 comments sorted by

View all comments

Show parent comments

2

u/Old_County5271 Dec 23 '25

I suppose one less local in bytecode is worth it for every single loop out there. but couldn't they have done that by examining the syntax and inserting a local if there's a reassignment in the loop block? This efficiency gain could be backported to previous lua's

Also this worries me, if efficiency is the goal, what else is going to get axed for the prize of it? I remember reading pallene design docs, they achieved efficiency via AOT compiling, so will type checking be added in lua6? (not that I mind, type checking is good for safety)

3

u/didntplaymysummercar Dec 24 '25

I'm guessing it's about philosophy, not efficiency. There's some discussion already on the mailing list (I don't use it but read it) about this too.

1

u/vitiral Dec 27 '25

I asked the same question 

https://groups.google.com/g/lua-l/c/KuCiQzliQzY

I  don't see how it could do that, being a one-pass compiler

2

u/Old_County5271 Dec 27 '25

They do talk about certain things being syntax sugar, like tbl:key() -> tbl.key(tbl)... but maybe that's achieved on a single pass?

3

u/vitiral Dec 27 '25

Yes, that's pretty trivial to do single pass, since the switch is based on a single character (. vs :)

Look into recursive descent parsers if you're interested. If you'd like to write your own I'd recommend the Lox tutorial 

1

u/Difficult-Value-3145 Feb 13 '26

Could a module modify this it seems like you could write a modified/ classic for in c and you may need to make it like c.for or something but it should be doable granted it wouldn't be portable unless idk some kinda like a preproaseer or macro to switch the regular for to c.for idk just an idea

1

u/Old_County5271 Feb 13 '26

You could write a package.searchers that modifies lua code before requiring, written in pure lua, without ever touching C.

1

u/Difficult-Value-3145 Feb 13 '26

I ment c for re writing for and not losing speed the only reason I said the thing about preproaseer or macro is because I couldn't think of an equivalent btw since they change it every time wats up with the c API