At the pilot for the Masters of Fine Arts in Software, I was once again motivated to get off my duff and get back into the trenches with a new language, and several others were very heavily into Ruby, so I thought I might go that way until Richard made a pitch for Lisp (which I wasn't that interested in) and CLOS. CLOS is Common Lisp Object System, and it sounded really powerful, so I went away thinking that maybe I should find out more about CLOS.
After searching far and wide, what I found was a bunch of different LISP dialects, and notes about each one like: "A really good implementation, but not very stable." or "looks promising, but couldn't get it to install." which led me to realize that there was almost no way I was going to be able to find a usable Lisp and get started with it without some help (which I didn't have). I also found a great series of articles by Paul Graham, describing what Lisp was and wasn't supposed to be, where its power was, and how the Lisp community had shot itself in the foot and destined itself for obscurity.
While Lisp has a number of great features (like memory management and runtime binding), what everyone was enthralled with was the fact that it has no syntax, and instead is written as expressions, which are parsed into lists, and then can be manipulated at runtime. Lisp's most powerful feature is its macro system (and the fact that the macros can act on themselves), so its really easy to create your own language--in fact the Lisp community is continually re-fracturing itself into thousands of splinter groups, so that its almost impossible to share any progress. This is a disease the smalltalk community seems to have as well, only they're not continually redefining the language, its just their environment that diverges and the fact that they don't have source files.
I've plowed into C++ templates enough to realize how having a separate limited language for macros is a shortcoming, but I was going to wait on the Lisp side of things to see if someone could cook up something resembling a syntax, and the ability to do useful things (like make system calls and communicate with other programs).
I did a quick background check on it and found this one article which described a set of speed tests between MzScheme (a lisp like thing), Ruby, Python on Lua. The author was hoping that MzScheme was the fastest, but it wasn't, though it made a respectable showing. The results were: Lua was always the fastest by quite a bit, MzScheme and Python switched for second and third, and Ruby was always last by a mile.
That pretty much sold it.
So I downloaded some Lua stuff and got started. So far I haven't scratched the surface very far. Tables are a builtin in Lua, though it does some weird stuff and lets you use them as lists too (basically using ints as keys from 1..n). One thing that is interesting, is that you can do multiple assignments, sort of like in perl:
And also like perl, they tried to be clever witha,b=1,2 ; val1, val2 = val2, val1 ; -- swap two vars without a temp
OR. Now in perl you can do cool stuff like
indx1= getindex() || 1 ;so that if
getindex()came back with 0, you could assign it a different value. Unfortunately if
0was a valid number you had to write out the test for
undefthe long way. Perl 6 adds
indx1= getindex() |& 1 ;which will only return
undef. Perl of course also lets you do things to existing variables, so in perl 6 you'll be able to say:
indx1 |&= 1;which is amazing compact and somewhat oblique to novices. But trust me, its cool, and I'd have used it all over the place if it was in perl 5.
Unfortunately Lua does not have increment, or the common C shortcut:
a += 1 ; which I am really scratching my head about, but it does have some pass through on
OR is of course supposed to be like
||, but I had never seen anyone try and do a passthrough in perl with
&&, so I was kind of scratching my head about what it was for till I got to the end of the section on expressions where they explained that they tried to implement the
a= expr ? val1 : val2 syntax from C. Basically, its supposed to work like this:
Unfortunately, if val1 isfinalval= expr AND val1 OR val2.
nilthen it doesn't actually work, so you can say the ternary C operator is partially supported; which is to say if you use this in your code and you know what you're doing it might work.
So far my impression is that the syntax could use some cleanup, the tables are neat (though perl has tables too), and I'm still waiting to find the silver bullet. But I'll keep plugging away at it for now.