lua-users home
lua-l archive

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


Hi guys,

Could you send me opinions about OOBIT patch? I would appreciate any opinion that could help me to decide the patch's future.

Status Report:

***********
OOBIT on tt field of values
status:  done
runtime cost:  1 additional AND on type read and 1 XOR, 1 AND and 1 OR on type write.

***********
OOBIT ooset and ooget functions
status: done

***********
Language extension to indicate REQUIRES SELF
status: done
how: adding METHOD keyword (could be done without a new keyword)

Example:

a ={}
a.name = 'Lua'
a.print = method() print('Name: ',a.name) end   -- solves a:f=function()...
a:print()                                       -- still uses colons

>> Name: Lua

***********
Set the OOBIT.of a function when it REQUIRES SELF
status: on queue (next thing to do)

***********
THE MAIN GOAL: Using just the dot syntax, automatically add a self parameter when a function requires it.
status - planning, prototyping

ESTIMATED COST (current approach) :

* 1 additional VM operation OP_AUTOSELF: it is an OP_SELF generated automatically (without colon)

* 1 extra stack parameter on every table call without colon, <path-to-table>.field()   (see 1)

* 4  to 16 additional fast/machine level operations to decide how to handle each CALL

* 4 to 10 additional fast/simple machine level operations to cleanup after the call

* a couple of additional integer fields


1 - I could not find a way to preserve the table without use of the stack. I think it´s not possible, but I will try a little more.
IMHO, this is the more expensive cost.

***********
PROS

* A safe way to eliminate the colon usage in function calls.

*
"REQUIRES SELF" enhances the function´s semantics what helps to detect "missing self" errors.

* If OOBIT is allowed to be set in other values - like tables - it could help to enhance the whole Lua´s OO experience.


CONS

* The extra runtime cost will be (a little bit) higher, whether the programmer use only dots in table calls or not.

*
To some platforms and/or applications, the extra runtime cost could be too expensive.

* I don´t know the impact on LUA JIT.

***********
Well, in your opinion, it´s worth?

You can send your
answer directly to my email, if the mailing list's rules allow (I´m new here).


Thanks.

--
Nilson