Subject | Re: [Firebird-Architect] embedding Lua as procedural language |
---|---|
Author | Jim Starkey |
Post date | 2008-12-18T21:15:09Z |
What advantages does Lua have over, say, JavaScript?
Computationally, the languages are quite similar. JavaScript has
exception handling, which Lua does not. JavaScript also has object
inheritance, which is a very nice thing if you think multi-instance
procedures are an important feature (which I do).
Both languages are designed for embedding, so I'd call that a draw.
Both require indirection through hash tables to access attributes,
including functions, so that's a draw, too.
Size is hard to quantify. There are scads of JavaScripts to chose from
with different trade-offs. Personally, I think the cost of compiling
into byte codes is a waste of time -- most time will be spent in
database processing and attribute management than executing operators.
The most important characteristic, I believe, is the cost of
instantiating an instance of "compiled" request. JavaScript can be
implemented so that is almost free -- a half dozen object allocations
and it's ready to go.
I'm far from a JavaScript bigot, but I've found that it is a more sound
language than it appears at first glance. It has, as they say, its good
faults and bad faults.
woodsmailbox wrote:
Jim Starkey
President, NimbusDB, Inc.
978 526-1376
Computationally, the languages are quite similar. JavaScript has
exception handling, which Lua does not. JavaScript also has object
inheritance, which is a very nice thing if you think multi-instance
procedures are an important feature (which I do).
Both languages are designed for embedding, so I'd call that a draw.
Both require indirection through hash tables to access attributes,
including functions, so that's a draw, too.
Size is hard to quantify. There are scads of JavaScripts to chose from
with different trade-offs. Personally, I think the cost of compiling
into byte codes is a waste of time -- most time will be spent in
database processing and attribute management than executing operators.
The most important characteristic, I believe, is the cost of
instantiating an instance of "compiled" request. JavaScript can be
implemented so that is almost free -- a half dozen object allocations
and it's ready to go.
I'm far from a JavaScript bigot, but I've found that it is a more sound
language than it appears at first glance. It has, as they say, its good
faults and bad faults.
woodsmailbox wrote:
> Hi. Found strange that there's no mention of Lua in devel list,--
> tracker, or support list, so I'll bring this up here, sorta like a
> feature request.
>
> Pros to pl/Lua:
> - Lua is *designed* for embedding, so its binding API gotta be clean
> and stable (people like Adobe and Blizzard already bet on it).
> - it's aligned to firebird's major design philosophy points:
> fast(1a, 1b) and small(2).
> - it's only data structure is the table-- that says a lot.
> - it's arguably closer to lisp in expressiveness power than to php,
> python or perl.
>
> Cons:
> - not a mainstream language unfortunately, so limited user target
> (but advanced features always have a limited target, and that doesn't
> diminish their importance, and besides, I think firebird users are
> well into the league).
> - you won't be getting any fancy libraries like you get with java.
> - anything else? please comment.
>
> Arguments:
>
> (propaganda)
> http://torch5.sourceforge.net/manual/Lua-1.html
> http://www.lua.org/about.html
>
> (1a)http://shootout.alioth.debian.org/gp4/lua.php
>
> (1b)http://www.timestretch.com/FractalBenchmark.html
>
> (2)"Lua is only 17000 lines of C code. Under Linux, the Lua
> interpreter built with all standard Lua libraries takes 153K and the
> Lua library takes 203K"
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
Jim Starkey
President, NimbusDB, Inc.
978 526-1376