[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Colon notation in object-oriented programming
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sun, 5 Mar 2017 18:00:43 +0200
2017-03-05 17:26 GMT+02:00 Peter Aronoff <firstname.lastname@example.org>:
> Dirk Laurie <email@example.com> wrote:
>> Have either of you adherents of `io.write(file, table.concat(results,
>> "\n"))`, one of whom claims to "do exactly this now", actually tried
>> running that line of code? If not, you have missed the point of that
>> example and in fact of my post.
> I haven’t tried that exact line. I suppose I have missed the point of that
> example and your post (in fact!). Sorry.
> My point was simply that I prefer to use procedural style. I never use the
> colon in Lua. (In point of fact, if we’re going to be precise, I nearly
> never use any of the functions in Lua’s io table “raw”. I have a small
> module of wrapper methods that I use for convenience. But the principle
> remains the same: I avoid the colon and prefer to pass the filehandle into
> the method.)
> Out of curiosity, what was your point?
The point of the example is that `io` is not the metatable, or the __index
metamethod, of a file. In fact,