[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: wiki sections for micro-patches?
- From: Javier Guerra Giraldez <javier@...>
- Date: Fri, 17 Feb 2012 09:55:55 -0500
On Fri, Feb 17, 2012 at 3:27 AM, Sven Olsen <email@example.com> wrote:
> As someone with a C++ background, the need to do explicit self-prefixing in
> lua has always bothered me, and getting rid of it makes the language feel
> much "cleaner".
i too have a like for C and C++ [*], and when i find a new language
with OOP constructs, one of the first things i check is if i have to
type 'self' or if it is implicit.
until a few years ago, i thought having explicit 'self' was a
drawback; but recently i did some work in C++, where i had to read
lots of existing code, and found that i had to repeatedly check if a
variable was local, global, or member. soon i was wishing that C++
enforced an explicit 'this->'
IOW: it's just habit, and it can enhance readability.
(also, if you really don't like to type 'self', you could just add
"_ENV=self" at the top of your functions, no need to break Lua)
[*] personally, i think for code-aesthetics, Lua and plain C
comfortably share the top of my ranking, with C++ and Python fighting
for second place. Scheme R5RS was nice too, but R6 went downwards
quickly (Go seems to be on the race too, but i have to get in peace
with some idioms)