[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to understand "invariant state" in generic for?
- From: Daurnimator <quae@...>
- Date: Tue, 18 Aug 2015 14:28:19 +1000
On 18 August 2015 at 13:51, Nan Xiao <xiaonan830818@gmail.com> wrote:
> Hi Daurnimator,
>
> "In this case I passed 'self' as the state parameter; which neatly
> lines up with the 'self' parameter required to the `next_foo` call."
>
> which neatly lines up with the 'last' parameter?
A function declaration with a colon: function foo:bar() end
adds a hidden `self` parameter. i.e. it is equivalent to: function
foo.bar(self) end