JakobOvrum/LuaD

const

TurkeyMan opened this issue · 0 comments

Questions is, should LuaD types attempt to support const in some useful manner?
Obviously const has severe interactivity problems with Lua, but some parts of the LuaD API are awkward without const.
For instance, LuaTable.length(); surely a function that should be const... but it's a bit awkward since the function effectively mutates the Lua stack to get the length of the table (push, get length, pop).
Thing is, it returns the Lua stack to the exact state that was before calling the function, so it's effectively const, even though it's technically not.
Should the LuaD API allow that functions that return the Lua stack to their initial state and have no other side-effects on the LuaState may be const? It will require some hard-casts, but it may reduce a lot of friction when typical D code is trying to make use of LuaD...?