lua-users home
lua-l archive

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


Yes, By working at the C level, I mean I need a C implemented version
for numbers. In the same way that +,- etc are implemented via C
macros. I'd rather not be generating code to translate it into a
variation of + and =, there are gotchas in there involving hygenic
translations and scoping. I also need a proper metamethod version. So,
yes, as Peter says, a new opcode is the way.

The multiple evaluation of the left-hand-side is a common issue,
because the easiest way to implement a+=b is as syntactic sugar for a
= a + b, which it isn't not equivalent to. Even if you get that right,
there are further issues when you have a metamethod type language
(same in python). Because you have to cope with

a[b] += c

where a[b] is calculated with some metamethod, and a[b] = c is
assigned with a potentially different metamethod. Both of which can
have side effects.

Still, a couple of the folks who've responded to me got the semantic
issue here, so I'm happy.

I like what you've done with MetaLua, Fabian. But in this project it
isn't for me. I'll do some playing with it over the next few months.

I have some knowledge of the Lua implementation and how it works, and
I have an excellent understanding of Lua itself. And I need to
leverage both of those. Learning MetaLua (even to the extent of
finding out in detail how it works), or any other flavour of Lua was
too high a burden. Given that a whole bunch of what I had to do with
the language was taking it away from the Lua syntax anyway. You're
right that compile time is only minimally important to me.

Ian.