News for hackers. Stuff that matters.
Re:Fengari – Lua for the Browser by BiteCode_dev on Sunday February 20, 2022 @09:30AM (#30405980)
Lua definitely does not have the power of something like Python.

That's usually what people like about Lua: it's barebone, yet high level and clean.

If one likes Python, then the chance of liking Lua are low.

E.G:

Both python and lua can open something (a file, a socket, a transaction...) in one line.

But only Python has the `with` construct that means it's easy to guaranty you close it in case of an error.

Lua is then easier to learn: one less concept to master. But the high level tool of Python, that you had to learn, make your life easier.

They have very different trade off.

Re:Fengari – Lua for the Browser by johnmaguire on Sunday February 20, 2022 @09:52AM (#30406135)
> If one likes Python, then the chance of liking Lua are low.

I don't know. I quite like both as well. The design ethos feels similar although Python has certainly added more features over the years.

Re:Fengari – Lua for the Browser by BiteCode_dev on Sunday February 20, 2022 @10:07AM (#30406239)
"with" existed in python 2. In python 2.6 in fact, like comprehension lists, decorators, generators, descriptor protocol, exotic slicing assignation, advanced nested unpacking, infinite parameters...

Python was always chock-full of advanced features, people just usually don't notice because they get productive in 3 days with the basic features and don't need to go further. It's has the quality of a very smooth learning curve, but a very long one if you care.

Re:Fengari – Lua for the Browser by johnmaguire on Sunday February 20, 2022 @09:36PM (#30411363)
"with" and "defer" (Go) are nice but not crucial to me.
Re:Fengari – Lua for the Browser by BiteCode_dev on Monday February 21, 2022 @04:56AM (#30413828)
My point exactly.
Re:Fengari – Lua for the Browser by pygy_ on Sunday February 20, 2022 @03:34PM (#30409038)
Lua 5.4 has to-be-closed variables that are similar in functions to with blocks in python.

Unkike the __gc hook which provides no guarantee as to when it will be called, if ever, the __close hook is called when a value goes out of scope.

http://www.lua.org/manual/5.4/manual.html#3.3.8