[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Injecting names & method chaining (was Re: [ANN] Penlight Libraries, First release)
- From: David Manura <dm.lua@...>
- Date: Fri, 1 May 2009 23:42:46 -0400
On Fri, May 1, 2009 at 11:31 PM, David Manura wrote:
> Or in standard Lua, we could write a helper function like
> chain(stringx, trim, 1,repeatchars,5, " test ")
Actually, more like chain(stringx, 'trim', 1,'repeatchars',5, 'upper',
nil, ' test ').
Another idea is chain(stringx):trim():repeatchars(5):upper()(' test
'), which may be preferable to the current approach in
MethodChainingWrapper. That even allows separation and reuse like
f = chain(stringx):trim():repeatchars(5):upper()
print ( f(' test ') )
print ( f(' again ') )