[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Getting Started with Lua
- From: Ralph Hempel <rhempel@...>
- Date: Fri, 26 Jul 2013 07:12:10 -0400
H. Conrad Cunningham wrote:
On Wed, Jul 24, 2013 at 3:16 PM, Jay Carlson<nop@nop.com> wrote:
To be fair, if your goal *is* to be able to build a SqueakVM- or Prescheme-like restricted Lua dialect which maps to C or machine instructions, getting "typical" bare metal ints into the language might help.
I am still formulating my goals. I had the following thoughts when
choosing Lua:
* It is a language that most of the students (in both the
undergraduate programming languages class and graduate class) do not
know, but it is simple and familiar enough in syntax that they should
be able learn it quickly. I want to use something different, but not
to have to devote much class time to teaching the language.
I cannot overstate the importance of this. My pbLua implementation for
LEGO MINDSTORMS NXT was used in a uni level class for non-CS majors and
one of the major benefits over the Java course the previous year was
avoiding a long break-in period before the students could _use_ the
language for anything interesting.
<http://ozark.hendrix.edu/~ferrer/roboticsBook/>
* It seems to support programming in multiple paradigms reasonably
well--procedural, functional, modular, "object-oriented" ,
nonpreemptive multitasking, language-oriented (using LPEG), etc. I
want the students to think about programming in different ways.
And again, the REPL philosophy helps here. Students can cut and paste to
a terminal, or simply reload the file into the interpreter. It's easy to
try things this way or that way, or experiment and inspect machine state
from the command line.
* It seems simple and small enough that its design and implementation
could be an object of study itself.
And for advanced students, you can at least use the Lua source as an
example of minimally documented source, but well documented APIs. And
then move on to a C binding for OS level stuff. For example, I modified
"luahidapi" in about 10 minutes to allow open to support a serial number
parameter.
There are too many interesting threads to follow in one semester.
Of course a disadvantage of Lua for me is that I normally prefer to
work with strictly and strongly typed languages and tend to be
opinionated about good programming "policy". :)
Also, I have not yet determined what is the best way to structure a
Lua "software family" as represented by the group of interpreters in
the last bullet above.
That's the hardest part - you need to play with the language intensely
for about 2 to 4 weeks. The magic of metatables is the stumbling block I
had to overcome. It's very similar to the hurdle of pointers for
students of C - if you don't understand that, then you'll never become
really fluent.
Cheers, and good luck - you sound like an excellent professor!
Ralph