lua-users home
lua-l archive

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


On Fri, Nov 30, 2018 at 8:39 AM Philippe Verdy <verdy_p@wanadoo.fr> wrote:
> For this reason, the generalization of the ":" pseudo-operator of Lua is not easy: it would create lot of overhead at compile-time and runtime to create many closure objects, that are compiled using a static "prototype" which is an  integer-indexed array mapping the numbered upvalues to their bound object, and then used at runtime to bind each actual upvalues to other accessible external objects

I agree, and have agreed since the beginning: the generalization is
inappropriate. Limit it to only using one per function call expression
and don't have it generate any sort of extra binding object; it simply
defines which object in the lookup is the one passed to the "self"
parameter. This is easy, efficient, useful, and most importantly
doesn't introduce overhead for the existing use case.

/s/ Adam