lua-users home
lua-l archive

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


steve donovan <steve.j.donovan@gmail.com> writes:

> Hi all,
>
> David M and myself were discussing the second question of the FAQ:
>
> http://batbytes.com/luafaq/#T1.2
>
> He thought that Lua is not that commonly used as a general purpose
> language, but rather as an embedded scripting language.  This is
> probably true.
>
> But the question du jour is more whether Lua can be used as a good
> introduction to programming, not necessarily as a 'trade skill'.  In
> the same way, CS departments have variously used Pascal or Scheme for
> this purpose.  Although Pascal was a rather frustrating language at
> the time (Brian Kernighan has an interesting essay on the subject) it
> was very good when I was a recovering FORTRAN programmer. (And Scheme
> is definitely not a 'trade skill')
>
> So, in other words, does it teach the basic concepts well?  Your
> answers will help #T1.2 have a less idiosyncratic answer ;)

Lua's data structures are not that of the underlying computer.  It does
not teach you what is computationally expensive, and what not.  And
since it has only one, it does not teach you how to pick.  For that, C
is a rather good fit (the seminal "Art of Computer Programming"
restricts itself to assembly language), with exceptions in the area of
arithmetic, where accessing the carry flag and mixed precision
operations are not practical.

C++ (also Java) build large complex languages over a C foundation.
Those buildings don't add anything of value that Lua does not also
provide.

C++ is designed like the button layout of a typical bandonion: there is
a small specialized regular area left and right that is just like its
earliest predecessors, the diatonic accordion where you had to change
bellows direction on each note for a scale, and had simple accompaniment
on the left side.  Around that, layers of irregular help buttons have
grown in order to have more and more notes available, like on other
instruments.  And the thing has become so heavy that changing bellows
direction became less feasible, and so more buttons are added to be able
to avoid changing directions.  The thing nowadays has a mostly
feature-complete collection of notes left, right, and for push and pull,
and all of those four are completely different due to historical
reasons.

Now look at a typical Argentinian playing tango: he never even _pushes_
the thing (because then he would have to double the notes and layouts he
has to learn by heart, and on push the thing reaches further, but is not
as complete), so you could just glue half of the reeds shut and improve
the air balance for those reeds that are actually used.  There is
historical sense and reason behind the layout, but unless he actually
learnt playing on one of the smaller predecessors of his instrument,
that's totally lost to him.

Which brings us to chromatic accordions.  You don't get to carefully
select whether to play a phrase or a part of the phrase on the push or
pull (like true masters would), because you get the same sound, anyway:
it is unisonoric.  And the notes are arranged sort of linearly with
regard to pitch.

Oh, by the way: anybody want to buy a Hohner Morino Club N accordion?
Perfectly in tune, and quite more coherent than a bandonion, even though
it is diatonic/bisonoric.

Uh, I digress.

For the FAQ answer:

Lua provides a rather well-sorted toolbox of excellent tools for solving
programming problems.  While it severely limits your ways of tailoring
data structures to make the best fit between problem and machine, the
available possibilities are typically fine.  "Serious" programming
nowadays heavily relies on frameworks and libraries, and those are quite
more limiting usually and also shield you from data structure choices of
your own.  When the difference effectively boils down to "you don't want
to know" vs "there is nothing more to know", the latter choice will let
you focus on your work and provides safety against fighting with strange
side effects.

-- 
David Kastrup