lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Tue, Feb 1, 2011 at 7:45 AM, Axel Kittenberger <> wrote:
> I gave a lot of thought into this, and I said no, you cannot put
> "extreme cleanliness" as replacement in there. Lua is much to
> pragmatic for that. Lua's adjectives are: small and fast. And thats
> it, thats also why I chose it, and somehow started to believe about
> easiness/cleaness, but it is not, and wasnt a goal. The degree it has
> on some places is by coincidence, and possible a sideeffect of
> reductionism. Example are: Lua has weak, dynamic typing, not a
> particular clean combo, but it circumvents most problems by having the
> concat operator and by only having one numeric type, so the pains on
> other languages with that combo by implicit floating point/integer
> conversation do not apply. A clean as in *extreme cleanliness*
> language would not implicitly translate between numbers and strings, a
> pragmatic language does. Same with truth value, "extreme cleanliness"
> would only allow true and false for logic operations, forcing you to
> write ~= nil to test on not nil. Same with (and sorry to bring it up
> again) #, in Lua it is small by not storing the last computed count in
> memory and fast by having O(log n) by doing binary search. A language
> that would put cleanliness above speed/size, would accept O(n) and do
> a linear walk, and optionally cache computed sizes. It is okay that
> Lua is not, its its niche. As I wrote before, in hindsight many of the
> discussions in the past are around this different goals. Implicit
> globals are another not so clean idea, that doesnt mean that implicit
> locals are not just as dirty, but a clean as in "extreme cleanliness"
> language, wouldn't do neither implicit - as has been written by David
> Olofson, what do a few more keystrokes then and when mean against
> spending a lot of time searching for a bug.
> So can we have some way to continue loops that is small and fast? Dont
> care about cleanliness, but another do end block just to continue is
> not a small solution either, is it?

As on any intrincate theme, and one so dear to us all, i agree on some
points and disagree on others :-)

agree, these are more pragmatic than clean:

- weak types (automatic strings and numbers conversion)
- more than one falsy values

disagree, these are more 'clean' than pragmatic:

- dynamic type (variables don't have type, values do)
- non-obvious #
- no 'continue'
- 'globals' are just table members

but obviously, some of these are matter of taste.  specially the
oft-mentioned # operator: it has a mathematically strict definition.
a pragmatic language would bend the conditions to make it more
obvious; a clean language just copes with what the internal structures
naturally give.

hum.... maybe that's part of the disagreement, in my eyes, a
significant part of what makes Lua clean is the transparent
implementation, not (only) the appearance of the code written in Lua.

but, given your points, i agree that "extreme cleanliness" might be an
exaggeration for Lua.  It's (by far) the cleanest language i know that
is still comfortable to use, but it's not as clean as it could
possibly be.