

A Functional Introduction to Lua - signa11
http://pragprog.com/magazines/2013-05/a-functional-introduction-to-lua

======
copx
Working with immutable data in Lua is not a good idea if you care about
performance. You end up generating a massive number of short-lived objects and
Lua is not built for that.

Java's advanced generational GC can handle it surprisingly well but of course
for decent performance you want a language implementation optimized for
working with immutable data (e.g. GHC, Clojure).

~~~
DanWaterworth
See also: [http://wiki.luajit.org/New-Garbage-
Collector](http://wiki.luajit.org/New-Garbage-Collector)

~~~
copx
Not there yet, not even close. Mike Pall announced his proposal for a new GC a
long time ago and thus far no sponsor has shown up.

I doubt there is enough interest. This is a major project (i.e. non-trivial
amount of sponsor money needed) and Lua users (including myself) seem to be
happy with Lua's simple, incremental GC. It does work well for typical Lua use
cases.

~~~
justincormack
I think that its more about there being other things people want sooner. He
seems to have a lot of sponsorship and has had open ended offers.

------
NickPollard
Lua is a very nice little language, and is great for embedding (I'm using it
for the Android game I'm currently developing).

Anyone who likes the functional side of Lua should checkout out Moonscript,
which I've started using recently. Moonscript is a CoffeeScript-inspired
language that compiles to Lua so can run everywhere Lua can, but has a more
concise and FP-style syntax - in particular, closures are much shorter and
nicer:

e.g.

    
    
        (x) -> x * x
    

vs.

    
    
        function(x) return x*x end
    

This makes writing higher-order function code much more compact and idiomatic.

~~~
simias
Given the small size (and IMHO good quality) of the lua source code wouldn't
it be more straightforward to fork it and make an implementation with a
different syntax? I think it would probably make debugging easier...

