lua-users home
lua-l archive

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


On Sep 15, 2009, at 8:41 AM, Rob Hoelz wrote:

On Tue, 15 Sep 2009 08:27:01 -0700
Mark Hamburg <mark@grubmah.com> wrote:

Here's a subtlety regard method currying: Does obj:method ==
obj:method -- i.e., do the results of currying get cached? I'm
inclined to say no because it would considerably complicate the
implementation, but then I wonder about how to enable it for cases
where it's needed. Here is a use case for caching:

	observed:addObserver( observer:callback )
	... later ...
	observed:removeObserver( observer:callback )

Mark


Along that same line:

setfenv(object:method, {foo = 'bar'})

Either these are special types and setfenv probably isn't allowed or it is allowed and doesn't matter since the closure that does the method invocation never looks at its globals. Still, an interesting point. It's all in the details.

Mark