lua-users home
lua-l archive

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

While reworking environments, is there any chance we could gain the ability to clone a function and assign it a new environment? I've wanted this when building object systems and thinking about how to wire up a super call for chained methods. There have been other times when it has seemed like it would be useful, but I haven't had enough caffeine yet this morning for them to come to me.

Also, if you are deprecating setfenv, then it probably makes sense to add an optional second parameter to the load routines which would provide the environment to associate with the loaded chunk though I guess you could do this with the new construction as:

	local f
	in environment do f = loadstring( code ) end

Provided you capture loadstring and code into local variables before the in construct.