Re:John Carmack working on Scheme as a VR scripting language
by david-given on Wednesday July 01, 2015 @01:47PM
(#9813752)
Threading I'll grant you, but prototype-based OO is practically Lua's defining feature. Could you expand?
[ Parent
| on HN ]
Re:John Carmack working on Scheme as a VR scripting language
by SeanLuke on Thursday July 02, 2015 @11:13PM
(#9823220)
Well, I guess that's not really fair. Obviously you can implement prototype-style OO, more or less, using the metatable and metamethod facilities. But as an old NewtonScript developer, I rather find
foo = { x = 1, y = 2 }
mt = { __index = bar }
setmetatable(foo, mt)
to be crazy compared to foo := { _proto: bar, x: 1, y: 2 }
The uncleanliness of function declarations in Lua compared to NewtonScript also gets to me in this way. At any rate, to me, the metatable facility feels like a hack. That's not to denigrate it: it's a very flexible and clever gizmo which can be used for a variety of cool things. But to me proto-style OO languages are notable for their elegance and simplicity, and metatables expose a fair bit of wiring and boilerplate. [It also wasn't a good sign that the whole OO section in "Programming in Lua" was about "classes" :-( ]