|
On 05/08/16 08:51 PM, Sean Conner wrote:
_SELF and _SUPER would make the compiler insert some things into the bytecode that don't get erased/don't count as "debug info".It was thus said that the Great Soni L. once stated:On 05/08/16 05:32 PM, Rain Gloom wrote:Just do your own debug.* hacks, I'm fairly positive you can embedd some debug.getinfo and .getlocal in your _ENV's __index and do it. On Fri, Aug 5, 2016 at 8:38 AM, steve donovan <steve.j.donovan@gmail.com <mailto:steve.j.donovan@gmail.com>> wrote: On Fri, Aug 5, 2016 at 8:34 AM, Thomas Jericke <tjericke@indel.ch <mailto:tjericke@indel.ch>> wrote: >> Doctor, when I put the finger into my own eye it hurts! > >> Then don't put it there. Exactly. Addiction to very short variable names leads to these symptoms.load(string.dump(chunk, true))() --> works with proposal, fails with debug.* (not counting sandbox support, compile-time optimizations, etc)Why does this fail? What doesn't work with debug.*? What is the problem you are trying to solve? Just saying "it doesn't work" doesn't tell *us* much about what this is trying to do. -spc
Using debug.* is literally relying on debug info. And order of locals/upvalues. And so on. None of that is guaranteed, while the proposal can use mechanisms not yet available and stuff.
For example, this code: local x; print(_SELF["x"]) Could produce a sequence of opcodes like: R(1) = nil -- e.g. LOADNIL R(2) = Upval[1][K(1)] -- e.g. GETTABUPR(3) = K(2)[K(3)] -- e.g. GETTABLEK / GETTABLE with a statically allocated table constant R(3) = R(R(3)) -- e.g. MOVEI / move from indirect register (because the I is on the right, and the RHS is the source)
R(2)(R(3)) -- e.g. CALL where: K(1) = "print" K(2) = statically allocated table: {["x"] = 1} K(3) = "x"This would be for reading only. For writing, it'd use R(R(x)) = R(y) (e.g. IMOVE) instead. For calling, it'd retrieve the current function from the call stack or something. For passing it around, it'd copy all locals into a table, maybe set a __call metamethod as well.
-- Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.