What's the performance & memory usage compared to Lua?
How sandboxable is it? Can you run untrusted code through it?
What's the performance & memory usage compared to Lua?
How sandboxable is it? Can you run untrusted code through it?
If this language is a valid alternative with a simple struct and a basic constructor, I may recommend it to remove all the Python scripts and their dependencies.
Honestly, off by one errors due to indexing was a lot harder to shake than getting used to meta tables.
Just curious. I’ve been kicking around some attempts to make programming simpler (though hopefully no less powerful) for casual programmers. Lua’s 1-based indexing gets a lot of critiques and, while I haven’t written a ton of Lua, can’t help but think that the critiques are due to us all being used to 0-based indexing. Which is a valid critique, especially for a scripting language, but one that applies less to novices.
local array = function(backing)
local res = { len = function() return #backing end }
setmetatable(res, {
__index = function(_, k) return backing[k + 1] end,
__newindex = function(_, k, v) backing[k + 1] = v end
})
return res
end
local x = array { 1, 2, 3 }
print(x[0]) -- 1
x[1] = 5
x[x.len()] = 6
for i = 0, x.len() - 1 do print(x[i]) end -- 1\n5\n3\n6There's times where doing math with array indexes is simpler with 0 and with 1-indexed arrays. I don't think I really found 0 to be difficult to learn; there are a great many more challenging things.
I wouldn't say "don't use a 1 indexed language" but I've also never found the arguments in favor of it to be compelling when using lua.
What signal are you sending to the running thread? What's the handler look like? How does that translate to terminating the thread? How do you do this forcibly (without cooperation from user code)? Schemes that I have seen look more like generating/ instrumenting polling/checkpoints into user code.
You can get lucky and sometimes avoid corruption, but eventually you're going to hit something important like leaving a libc heap allocator mutex locked when you kill a thread in the middle of an allocation.
This doesn't limit compute power of the thread.
It's an all or nothing approach; either the thread runs or is killed, which doesn't work (as you point out) for all circumstances where you want to limit the amount of compute pwr a thread can use.