lua-users home
lua-l archive

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

>>'set', ...)
>>'lpush', ....)

>> I could theoretically recognize that these commands are not
>> dependent on each other and [batch them].

> It's harder than you think.  [These]

> 	x = { 7 , 8 , 9 }
> 	foo(x,'welcome')
> 	foo(x,'come again')

> might not be [independent of each other], if foo() changes the given
> table.

True, but since this is about allowing the implementation of foo() to
tell whether the return value is used, that implementation presumably
can know when all such side effects, if any, are complete, ie, at what
point it can potentially defer/batch further work.

Another reason for wanting to do this (though perhaps not in this
particular case) is not to _defer_ some of the work but to _avoid_ it.
If computing the return value is expensive, it can be desirable to skip
doing so if it's not going to get used.  Conceptually, this sounds to
me like a place for...I don't know if Lua has anything like this, some
kind of deferred-execution value.  Forcing thunks?  Calling in
promises?  I've seen a bunch of terms I don't really understand....

> [2]	[...].  It's modifiable table references all the way down.


/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B