[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: wiki sections for micro-patches?
- From: Sven Olsen <sven2718@...>
- Date: Fri, 17 Feb 2012 11:07:37 -0800
IOW: it's just habit, and it can enhance readability.
Yeah, I'm quite willing to admit that implicit vs. explicit self referencing is basically just a question of taste; particularly given that under 5.2 one can easily get 90% of the way towards an implicit self pattern by just declaring member functions that have an explicit _ENV as their first parameter.
That said, the neat thing about lua is that it's a small, elegant language that gives you a couple powerful tools, and then leaves it to you to craft higher level structures out of them. Via metatables, you already have a huge amount of control over what level of implicit vs. explicit specification you want to require of people. The implicit "self" created by ":" declarations always struck me as a minimally useful piece of sugar though -- why make self implicit in the parameter list, only to force people to type it every time they reference a member variable? Swap "_ENV" for self though, and suddenly lua can go that extra 10% of the way towards supporting a C++ style implicit self.
It seems like a good trade to me, though of course, anyone working on a project that needs compatibility with vanillia lua should be warned to stay well away from it :)