Re:GopherLua: VM and Compiler for Lua in Go
by SixSigma on Sunday February 22, 2015 @03:58AM
(#9088773)
And what a useless comment GETBX is.
Re:GopherLua: VM and Compiler for Lua in Go
by Intermernet on Sunday February 22, 2015 @04:02AM
(#9088782)
This in itself isn't a bad thing. When I'm porting code, I try to start with a proven code-base and port from there, while iterating the code to make it more idiomatic (e.g. "case OP_LOADK" is not idiomatic Go).
The problem is, if the author has based their code on this library, they seem not to have credited it (At least, I couldn't find it on my cursory look at the file headers).
For example, it appears to use the same opcodes and the main VM loop looks very similar:
http://www.lua.org/source/5.1/lvm.c.html
https://github.com/yuin/gopher-lua/blob/master/vm.go
It's interesting because the Go source appears to be annotating certain patterns with comments where the C version uses a macro. Compare the C version:
With the Go version: