Re: Regarding the name 'pairs'
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Regarding the name 'pairs'
- From: steve donovan <steve.j.donovan@...>
- Date: 2009年9月11日 12:13:19 +0200
On Fri, Sep 11, 2009 at 12:03 PM, John Hind <john.hind@zen.co.uk> wrote:
> On the other hand, using the "__call" metamethod you CAN write:
>
> for v in myobject do print(v) end
>
> without the empty parenthesis, which seems inconsistent since both cases are
> ultimately just function calls.
Yes, because myobject is callable. But myobject:iter() _returns_ a
callable, usually a closure that contains iterator state.
That's the difference.
PS, I do agree that __ipairs and __pairs seems silly.
steve d.