[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 5.2 feature list?
- From: David Olofson <david@...>
- Date: Tue, 3 Oct 2006 16:49:07 +0200
On Tuesday 03 October 2006 15:30, John Hind wrote:
[...]
> Would Roberto maybe admit that if he was redesigning Lua from
> scratch today variables would be local by default and global by
> declaration? If not, why not?
I don't really understand why anyone would want variables to be
*anything* by default, as in automatic declarations. All it does is
save you a few keystrokes every now and then, while opening up for
endless fun looking for stupid, hard to find typo and name mixup
bugs. (Assignment instead of declaration and vice versa.)
I wasn't really aware of this issue at first (haven't designed all
that many languages before), and of course, got it wrong in EEL
(local by default), did some scripting, realized it was just plain
stupid, switched to explicit declarations for everything, and never
looked back.
I'd almost go as far as saying that in general, default behavior,
pretty much anywhere, is a Bad Thing(TM). It opens up for non-obvious
bugs, makes the code harder to understand (especially if you have to
deal with multiple languages), and probably a bunch of other things
I'm forgetting right now.
Considering that we already spend too much time debugging and too
little time actually writing new code, I don't see how saving a few
keystrokes here and there can be a good deal, ever. (And this is
coming from someone who dislikes verbose programming
languages...! :-D )
//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 --'