lua-users home
lua-l archive

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


On May 1, 2014 12:44 PM, "steve donovan" <steve.j.donovan@gmail.com> wrote:
>
> On Thu, May 1, 2014 at 6:24 PM, Thomas Jericke <tjericke@indel.ch> wrote:
> > That's already the case. The : operator is inconsistent and the use of
> > the colon operator is hard to explain as it is now. I often get calls from
> > customers who ask me: "When do I have to use the ':' operator?"
>
> It does puzzle newcomers, but it's the price of "no magic".  

It puzzles *me*, most frequently in iterators. By now I know io.lines() but io.stdin:lines(). Do any of the static typing systems for Lua diagnose "I am a singleton, and/or you should not use : on calls to me"? This information is not available at runtime either, so you can't assert().

Because not all values would participate in the protocol, perhaps the asserts would have to work off "__uses_methods" and "__does_not_use_methods" characteristics and before calling o:m() you'd assert(not __does_not_use_methods). Bleh.