[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: Sat, 2 May 2009 13:50:03 -0400
On Sat, May 2, 2009 at 9:59 AM, steve donovan wrote:
> Any methods which are not recognized are looked up using the first
> value of the sequence:
> S{'[one]','[two]','[three]'}:sub(2,-2):upper():printall() ---> ONE TWO THREE
Caching of the first function goes against dynamic binding.
It would be nice to be able to switch between a sequence and table
implementation merely by switching the implementation of S (as memory
and performance requirements change).
The method chaining can also be made to have the semantics of Forth
(the input to each filter being the previous stack).
On Sat, May 2, 2009 at 1:37 AM, Mark Hamburg wrote:
> P.S. The obj:[ method ] syntax suggestion actually arose out of wanting to
> make it easier to call variable methods without expanding the colon operator
> and thereby muddying the waters about the intent of the code.
This would also allow non-alphanumeric method names:
z = N(x):['2 * x^y'](n):['x + 1/x']()()
-- same as z = 2 * x^n + 1 / (2 * x^n)
-- where methods are created on the fly
-- via http://lua-users.org/wiki/ShortAnonymousFunctions
- References:
- Injecting names & method chaining (was Re: [ANN] Penlight Libraries, First release), Mark Hamburg
- Re: Injecting names & method chaining (was Re: [ANN] Penlight Libraries, First release), David Manura
- Re: Injecting names & method chaining (was Re: [ANN] Penlight Libraries, First release), David Manura
- Re: Injecting names & method chaining (was Re: [ANN] Penlight Libraries, First release), Mark Hamburg
- Re: Injecting names & method chaining (was Re: [ANN] Penlight Libraries, First release), steve donovan