[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why a : (colon) operator?
- From: David Olofson <david@...>
- Date: Wed, 13 Sep 2006 23:24:37 +0200
On Wednesday 13 September 2006 22:17, Luiz Henrique de Figueiredo
> > I wonder why a new ':' operator was added?
> To provide support for object-oriented programming.
> See our paper on the evolution of Lua, section 5.2:
As I understood the original post, the question was not about the use
or function of the operator, but rather why "self" isn't just passed
all the time by the . operator or something, so that you don't have
to worry about it when coding.
My guess would be that the cost of doing so is not insignificant,
which makes it a bad idea for a language that isn't OOP-only. Also,
using : instead of . at least serves as a hint that you're not *only*
indexing something to get your function, which I believe is a good
thing. (Languages with lots of implicit side effects, default actions
and whatnot tend to be very easy to misread, especially for
programmers dealing with multiple languages. IMNSHO, it's just not
worth it to save a few keystrokes here and there.)
//David Olofson - Programmer, Composer, Open Source Advocate
.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
'-- http://www.reologica.se - Rheology instrumentation --'