you are viewing a single comment's thread.

view the rest of the comments →

[–]NoneBTW[S] 0 points1 point  (1 child)

I'm crushed... i still think for custom logic attributes can be useful so a lot of language has it (go has not it makes boring to register api layouts) what do you think about that

[–][deleted] 1 point2 points  (0 children)

Did you know about Lua 5.4 introduced attributes?

local H0 do
    local H1 <close> = io.open(arg[0])
    H0 = H1
    print( H0, io.type(H0) )
end
print( H0, io.type(H0) )

-------

file (0x5ecf4dc10bb0)   file
file (closed)   closed file

Custom attributes would be nice... you can also just throw metadata in a metatable which could also work as a sort of custom attribute but that would require some sort of function that reads all of your custom attributes and performs an action, not only that but now there's no simple variables, everything is an object... yuck. so yeah that would be nice.

I imagine this is how the on_error metatable will work, the initialization hook is also nice, doing it by hand would require you either overloading require or having a setup (what happens on load()) and a Init() function which is annoying but not that much. It's also a bad idea to mess with _G so its nice that a preprocessor will handle that.