
How the embeddability of Lua impacted its design - Rickasaurus
http://queue.acm.org/detail.cfm?id=1983083
======
dkhenry
I initially picked up Lua because it was so easy to embed ( also it was small
). Recently I have seen it used more as a stand alone language, but it really
shines when you need to add a scripting layer to an existing project. I was
making a GUI for a control system and I exposed all the drawing primitives and
control points to Lua and was able to get a very fast prototype cycle working.

------
jacques_chester
One of the classic FAQs about Lua is:

 _"Why doesn't Lua have unicode support?"_

I mean, it _does_ , but in the same fashion as ANSI C: you need to either pick
a convention for multibyte characters or use a third-party library.

And that's not an accident. One part of Lua's embeddability design is that the
standard implementation is written in pure ANSI C, and pure ANSI C ... doesn't
support unicode.

~~~
zurn
Standard C has wchar_t, which is used for Unicode on platforms supporting
Unicode.

~~~
jacques_chester
wchar_t is implementation-specific.

~~~
zurn
Sure. char is not specified to support ASCII either but it's not really a
problem in practice :)

If you start avoiding all the things that are not fully specified by the
standard, your C programs will end up doing very little indeed.

Now, it might be that some environments targeted by Lua have very spartan C
runtimes: consoles. Anyone have a pointer to the C runtime docs for Xbox 360
and PS3?

------
aidenn0
Hmm, the majority of this is about implementation, not semantics. I like
looking at choices made in the Kyoto family of lisps versus most other CL
implementations as good examples of tradeoffs when embedding.

~~~
Rickasaurus
I'd love to read a blog post or paper on this topic.

~~~
jacques_chester
A fairly detailed paper on Lua was published in HOPL-III in 2007:
<http://www.lua.org/doc/hopl.pdf>

------
cousin_it
It just occurred to me that a language could be made embeddable using eval()
alone, with okay performance. We just need to take a page from SQL's book and
introduce "prepared statements" for eval. A string of high-level code with
placeholders could be parsed only once, and converted into an object you can
"call" using different values for the placeholders. I'm pretty sure this isn't
a new idea, though.

------
goldfeld
Somewhat OT, I can't believe I'll end up dropping out of college before I take
a class with Ierusalimschy. I've been told he will usually wear a bermuda and
flip flops to class but unfortunately those are few and far between for
undergrads, only Compilers that I've heard of, while most of his work is with
grad school.

~~~
ufo
As someone that has recently moved to Rio, I have to confess I'm baffled at
how people manage to _not_ wear a bermuda. Its so hot here!

Other then that, I think he gives some lectures on semantics every once on a
while. The compilers class is only rarely offered since so few people take it
:/

