lua-users home
lua-l archive

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


Henk Boom wrote:
local tbl = {... ..., 7, 8, 9}

would be a bit strange, no?

    Henk
(I've just realized I wrote ReturnSixIncrementalValuesFromZeroToSix() instead of ReturnSixIncrementalValuesFromOneToSix(), oops!)

Well, we need a way to expand and insert all the args of the cmd into a table, it's a very useful feature IMHO, and I was bitten quite a few times when I started working with Lua tables for the first time. Personally I think it makes more sense for all the arguments to be pass out, but then it makes it very hard I guess to handle cases like:

local varA, varB = FooTwoNums() + 5

Do you add five to the first or the second number? Or both? What happens if there are more returns then there are allocations? Do we do a mass additional on all of them SIMD style (though obviously not actual SIMD code)? What if the type of the values aren't a number? Do we move on to the next return value? Do we error? Or do we do nothing?

Although I guess that SIMD thing could be nifty in some cases, you know, mass applying a set of ops on multiple values at once. If the parser could take that into account I'm all but certain it would be possible to do a micro-optimization at that point. Then again, the vanilla Lua compiler isn't an optimizing compiler according to the wiki.

Olivier