lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Aug 23, 2014 at 9:47 AM, Coroutines <coroutines@gmail.com> wrote:
> All I'm thinking about is things like this:
> string.sub(io.stdout, 1) -- dumping the lua_Stream struct into a Lua string

Ah, but then you're depending on the hidden binary representation of
userdata. In this case, files are represented differently in Lua 5.1,
5.2 and LuaJIT 2 (which is why using Lua file objects from C is a
delicate business). I think this encapsulation is a feature, not a
bug;  otherwise the representation cannot change or evolve since
client code has come to depend on particular byte layouts.

> On another side-topic: It makes me really unhappy that
> lua_lock/unlock() are macros and not dummy functions.

Au contraire, it makes me happy, because then Lua is not slowed down
by having to call those dummies.  What is so hard about recompiling
Lua?  Granted, one cannot then do one's favourite tricks with the
stock Lua interpreter, but excessive flexibility hurts general
performance.

steve d.