[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: default values of 'false' in data description
- From: David Olofson <david@...>
- Date: Thu, 14 Sep 2006 22:17:31 +0200
On Thursday 14 September 2006 22:00, Javier Guerra wrote:
> On Thursday 14 September 2006 2:40 pm, Paul Hudson wrote:
> > >Or how about everything becomes an expression:
> >
> > Ah! Another step on the secret plan to turn Lua into Lisp :)
>
> i don't remember if there was any particular objection to that
> feature. apart from being a profound change to current grammar, of
> course.
>
> could anybody elaborate on the downsides of everyting (or most
> things) being an expression?
Well, there is the classical C mistake: if(a = b) ..., which compiles
just fine, but doesn't do what the programmer (probably) intended.
This just won't compile if an assignment does not generate a value.
Although I think "most things are expressions" can be rather handy, it
doesn't exactly make the language safe and friendly. It allows you to
write rather clever and compact code - but it also makes it very easy
to write incomprehensible code, and it opens up for a bunch of
pitfalls like the aforementioned C thing.
Meanwhile, what does it really add to a language that isn't designed
from the ground up around the "everything is an expression" idea...?
It's not that I like languages that try to teach you "good" habits.
(On the contrary, I'm experienced and arrogant enough to - sometimes
incorrectly - believe that I don't need babysitting. ;-) It's just
that some tools tend to be more dangerous than they are useful.
//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 --'